Skip to content

Commit a3e4a29

Browse files
committed
reservations: check if channel is closing
This commit adds a check to the runtime loop of the reservation manager to check if the channel is closing before trying to read from it.
1 parent 2c32575 commit a3e4a29

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

instantout/reservation/manager.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,12 @@ func (m *Manager) Run(ctx context.Context, height int32) error {
6464
log.Debugf("Received block %v", height)
6565
currentHeight = height
6666

67-
case reservationRes := <-ntfnChan:
67+
case reservationRes, ok := <-ntfnChan:
68+
if !ok {
69+
// The channel has been closed, we'll stop the
70+
// reservation manager.
71+
return nil
72+
}
6873
log.Debugf("Received reservation %x",
6974
reservationRes.ReservationId)
7075
_, err := m.newReservation(

0 commit comments

Comments
 (0)