s12v/go-jwks

refreshKey in background routine should have Background context?

andresvia opened this issue · 0 comments

By the time sem is released the context may have been done, if is ok to use context.Background() I'll be happy to open a PR.

go-jwks/client.go

Lines 63 to 68 in f5cc55a

go func() {
defer c.sem.Release(1)
if _, err := c.refreshKey(ctx, keyId, use); err != nil {
logger.Printf("unable to refresh key: %v", err)
}
}()

seeing this message in production prompted me to come here and create this issue:

unable to refresh key: Get "<the jwks source url>": context canceled