Skip to content

Commit 4fefd99

Browse files
committed
Add additional comment on blocking the tokio reactor
1 parent 60a52ee commit 4fefd99

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,12 @@ impl<L: Deref + Clone + Send + Sync + 'static> RapidSyncProcessor<L> where L::Ta
109109
if config::DOWNLOAD_NEW_GOSSIP {
110110
let (mut persister, persistence_sender) =
111111
GossipPersister::new(self.logger.clone()).await;
112+
112113
log_info!(self.logger, "Starting gossip db persistence listener");
114+
// We persist gossip to postgres in a separate runtime as we can end up blocking on it
115+
// (indirectly via the async queue getting full) with sync mutexes held (esp
116+
// PeerManager's peers mutex). Otherwise, blocking on it could result in blocking the
117+
// tokio reactor which we're waiting on to complete postgres writes.
113118
let runtime = Builder::new_multi_thread()
114119
.enable_all().worker_threads(2).thread_name("postgres-writer") .build().unwrap();
115120
runtime.spawn(async move { persister.persist_gossip().await; });

0 commit comments

Comments
 (0)