Skip to content

Commit

Permalink
fix(inventory): drain stale inventory status from inventory update ch…
Browse files Browse the repository at this point in the history
…annel (#231)

Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian authored Apr 16, 2024
1 parent a41a724 commit c554a1c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions cluster/inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,12 +622,17 @@ loop:
} else {
inventoryRequestsCounter.WithLabelValues("status", "error").Inc()
}
case inv, open := <-invch:
if !open {
case inv := <-invch:
if inv == nil {
continue
}

invupch <- inv
select {
case invupch <- inv:
default:
<-invupch
invupch <- inv
}
case inv := <-invupch:
currinv = inv.Dup()
state.inventory = inv
Expand All @@ -653,6 +658,7 @@ loop:
}
}
}
// updateInventory(inv)
case run := <-runch:
runch = nil
t.Reset(5 * time.Second)
Expand Down Expand Up @@ -684,13 +690,16 @@ loop:
updateReservationMetrics(state.reservations)
}

is.log.Debug("shutting down")
if runch != nil {
<-runch
}

if is.clients.ip != nil {
is.clients.ip.Stop()
}

is.log.Debug("shutdown complete")
}

type confirmationItem struct {
Expand Down

0 comments on commit c554a1c

Please sign in to comment.