Use select statement to prevent blocking on context status check
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Elara 2023-06-28 21:49:07 -07:00
parent 1c623051ec
commit ac7c626f56
1 changed files with 6 additions and 4 deletions

View File

@ -9,7 +9,6 @@ import (
"net/url"
"strconv"
"strings"
"time"
"go.elara.ws/infinitime"
@ -86,9 +85,12 @@ func initWeather(ctx context.Context, wg WaitGroup, dev *infinitime.Device) erro
go func() {
defer wg.Done("weather")
for {
_, ok := <-ctx.Done()
if !ok {
return
select {
case _, ok := <-ctx.Done():
if !ok {
return
}
default:
}
// Attempt to get weather