Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep trying to receive websocket notification in test #1423

Merged
merged 1 commit into from
Jan 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions jmclient/test/test_wallet_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ def test_notif(self):
# create a small delay between the instruction to send
# the notification, and the checking of its receipt,
# otherwise the client will be queried before the notification
# arrived:
# arrived. We will try a few times before giving up.
self.attempt_receipt_counter = 0
d.addCallback(self.wait_to_receive)
return d

Expand All @@ -178,7 +179,13 @@ def wait_to_receive(self, res):
return d

def checkNotifs(self):
assert self.client_factory.notifs == 1
if self.attempt_receipt_counter > 10:
assert False
if not self.client_factory.notifs == 1:
jlog.info("Failed to receive notification, waiting and trying again")
self.attempt_receipt_counter += 1
d = task.deferLater(reactor, 0.2, self.checkNotifs)
return d

def fire_tx_notif(self):
self.daemon.wss_factory.sendTxNotification(self.test_tx,
Expand Down