riverqueue / river

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

Fix set state if running query bug #560

Closed bgentry closed 2 weeks ago

bgentry commented 3 weeks ago

While doing some work on a related query, I noticed that the unique_key is being cleared here specifically if the new state is explicitly cancelled, but not if the state is being set to cancel because of a cancellation attempt that didn't get picked up before the job completed.

I didn't yet add test coverage for this but wanted to at least commit it before I forgot. Probably worth it given that this is super nuanced and could easily break in the future?

I also took the occasion to upgrade to sqlc v1.27 in this PR because I picked it up from Homebrew, but I'm opening a separate PR for that too.