Skip to content

Commit 501faa8

Browse files
committed
sweepbatcher: unblock sending if notifier quits
1 parent 6a32b46 commit 501faa8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

sweepbatcher/sweep_batcher.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,15 +1176,31 @@ func (b *Batcher) monitorSpendAndNotify(ctx context.Context, sweep *sweep,
11761176
}
11771177

11781178
select {
1179+
// Try to write the update to the notification
1180+
// channel.
11791181
case notifier.SpendChan <- spendDetail:
1182+
1183+
// If a quit signal was provided by the swap,
1184+
// continue.
1185+
case <-notifier.QuitChan:
1186+
1187+
// If the context was canceled, stop.
11801188
case <-ctx.Done():
11811189
}
11821190

11831191
return
11841192

11851193
case err := <-spendErr:
11861194
select {
1195+
// Try to write the error to the notification
1196+
// channel.
11871197
case notifier.SpendErrChan <- err:
1198+
1199+
// If a quit signal was provided by the swap,
1200+
// continue.
1201+
case <-notifier.QuitChan:
1202+
1203+
// If the context was canceled, stop.
11881204
case <-ctx.Done():
11891205
}
11901206

@@ -1194,9 +1210,11 @@ func (b *Batcher) monitorSpendAndNotify(ctx context.Context, sweep *sweep,
11941210

11951211
return
11961212

1213+
// If a quit signal was provided by the swap, continue.
11971214
case <-notifier.QuitChan:
11981215
return
11991216

1217+
// If the context was canceled, stop.
12001218
case <-ctx.Done():
12011219
return
12021220
}

0 commit comments

Comments
 (0)