Skip to content

Commit 7dc78dd

Browse files
authored
fix: ensure heartbeat resumes after executing withHeartbeatPaused (signum-network#855)
1 parent 15dd35d commit 7dc78dd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/brs/web/api/ws/BlockchainEventNotifier.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,11 @@ private void withActiveConnectionsOnly(Runnable fn) {
5050

5151
private void withHeartbeatPaused(Runnable fn) {
5252
heartbeat.pause();
53-
fn.run();
54-
heartbeat.resume();
53+
try {
54+
fn.run();
55+
} finally {
56+
heartbeat.resume();
57+
}
5558
}
5659

5760
private void sendToAll(Consumer<WebSocketConnection> fn) {

0 commit comments

Comments
 (0)