imgbundler: Use time.Ticker instead

This commit is contained in:
Anmol Sethi 2022-11-30 14:44:02 -08:00
parent e3104688a6
commit 1d2ea2bb87
No known key found for this signature in database
GPG key ID: 25BC68888A99A8BA

View file

@ -122,11 +122,13 @@ func runWorkers(ctx context.Context, ms *xmain.State, svg []byte, imgs [][][]byt
}
}()
t := time.NewTicker(time.Second * 5)
defer t.Stop()
for {
select {
case <-ctx.Done():
return svg, xerrors.Errorf("failed to wait for workers: %w", ctx.Err())
case <-time.After(time.Second * 5):
case <-t.C:
ms.Log.Info.Printf("fetching images...")
case repl, ok := <-replc:
if !ok {