queue: when shutting down, wait for pending deliveries before signaling that shutdown is complete

also fixes flaky test, which is how i found it
This commit is contained in:
Mechiel Lukkien
2024-04-28 22:48:51 +02:00
parent ff6cca1bf9
commit b7ec84b80a
4 changed files with 10 additions and 5 deletions

View File

@ -1006,6 +1006,10 @@ func startHookQueue(done chan struct{}) {
for {
select {
case <-mox.Shutdown.Done():
for len(busyHookURLs) > 0 {
url := <-hookDeliveryResults
delete(busyHookURLs, url)
}
done <- struct{}{}
return
case <-hookqueue: