Skip to content

Commit 7e5d280

Browse files
authored
fix: start listening to messages after start up (#518)
1 parent f99e5ee commit 7e5d280

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

crates/tap-agent/src/agent/sender_accounts_manager.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,7 @@ impl Actor for SenderAccountsManager {
112112
.expect("Failed to update indexer_allocations_set channel");
113113
async {}
114114
});
115-
let mut pglistener = PgListener::connect_with(&pgpool.clone()).await.unwrap();
116-
pglistener
117-
.listen("scalar_tap_receipt_notification")
118-
.await
119-
.expect(
120-
"should be able to subscribe to Postgres Notify events on the channel \
121-
'scalar_tap_receipt_notification'",
122-
);
115+
let pglistener = PgListener::connect_with(&pgpool.clone()).await.unwrap();
123116
let myself_clone = myself.clone();
124117
let accounts_clone = escrow_accounts.clone();
125118
let _eligible_allocations_senders_handle =
@@ -475,6 +468,13 @@ async fn new_receipts_watcher(
475468
escrow_accounts_rx: Receiver<EscrowAccounts>,
476469
prefix: Option<String>,
477470
) {
471+
pglistener
472+
.listen("scalar_tap_receipt_notification")
473+
.await
474+
.expect(
475+
"should be able to subscribe to Postgres Notify events on the channel \
476+
'scalar_tap_receipt_notification'",
477+
);
478478
loop {
479479
// TODO: recover from errors or shutdown the whole program?
480480
let pg_notification = pglistener.recv().await.expect(

0 commit comments

Comments
 (0)