riverqueue / river

Fast and reliable background jobs in Go
https://riverqueue.com
Mozilla Public License 2.0
2.86k stars 68 forks source link

elector: resign leadership w/ WithoutCancel ctx, not background #403

Closed bgentry closed 3 weeks ago

bgentry commented 3 weeks ago

Borrowing an idea from #401, rather than using a background context for a shutdown operation that we don't want to be prematurely immediately cancelled, we can instead use a context.WithoutCancel(ctx) to maintain non-cancel parts of the context.

I also updated logger calls in here to use the Context variants for consitency.