From 3d9c79e752a7cee08f0aca5c32c61ad4d4fe152a Mon Sep 17 00:00:00 2001 From: evgeny Date: Tue, 22 Sep 2026 01:21:51 +0300 Subject: [PATCH] =?UTF-8?q?db=5Fsync:=20=D1=82=D1=80=D0=BE=D1=82=D1=82?= =?UTF-8?q?=D0=BB=D0=B8=D0=BD=D0=B3=20push=20=D0=BA=20=D1=81=D0=BF=D1=8F?= =?UTF-8?q?=D1=89=D0=B5=D0=BC=D1=83=20=D0=BF=D0=B8=D1=80=D1=83=20=D0=B2=20?= =?UTF-8?q?=D1=82=D0=B8=D1=85=D0=BE=D0=BC=20=D1=87=D0=B0=D1=82=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chat/db_sync.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/chat/db_sync.c b/src/chat/db_sync.c index 90e6c4fe..d88bc7cb 100644 --- a/src/chat/db_sync.c +++ b/src/chat/db_sync.c @@ -25,6 +25,7 @@ // ---- Forward declarations ---- struct DB_SYNC; struct DB_SYNC_INSTANCE; +struct SI_PEER; static void db_sync_recv_cb(struct ETCP_CONN* conn, struct ll_entry* entry); static void db_sync_on_conn_status(struct ETCP_CONN* conn, int status, void* arg); @@ -38,6 +39,7 @@ static int db_sync_send_gid(struct DB_SYNC* db, uint64_t node_id, uint64_t grou static void db_sync_initiate_sync(struct DB_SYNC_INSTANCE* si, uint64_t peer_node_id); static int si_send_data_batch(struct DB_SYNC_INSTANCE* si, uint64_t dst, uint32_t from, uint32_t count, uint32_t vp, uint32_t want_from); static void si_delivery_update(struct DB_SYNC_INSTANCE* si, uint64_t ts, uint64_t author, uint64_t peer_id); +static int db_sync_peer_throttled(struct DB_SYNC* db, struct SI_PEER* p); // ============================================================ // Structures @@ -674,6 +676,7 @@ static int db_record_insert_cascade(struct DB_SYNC_INSTANCE* si, for (int i = 0; i < si->peer_count; i++) { uint64_t pid = si->peers[i].node_id; if (si->peers[i].sync_state >= 1 && pid != source_peer && pid != my_id) { + if (db_sync_peer_throttled(si->db_sync, &si->peers[i])) continue; /* спящий пир в «тихом» чате — не пушим */ if (db_sync_send(si, pid, pbuf, poff) >= 0) { si_delivery_update(si, rts, rauthor, pid); push_count++; } }