Skip to content

Commit

Permalink
Add note about upgrading
Browse files Browse the repository at this point in the history
  • Loading branch information
mhenrixon committed Jun 29, 2021
1 parent a83ab10 commit 84abb58
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Upgrading

## v7.0.13

SidekiqUniqueJobs do not log by default anymore. Instead I have a reflection API that I shamelessly borrowed from Rpush.

To use the new notification/reflection system please define them as follows in an initializer of your choosing.

```ruby
SidekiqUniqueJobs.reflect do |on|
# Only raised when you have defined such a callback
on.after_unlock_callback_failed do |job_hash|
logger.warn(job_hash.merge(message: "Unlock callback failed"))
end

# This job is skipped because it is a duplicate
on.duplicate do |job_hash|
logger.warn(job_hash.merge(message: "Duplicate Job"))
end

# This means your code broke and we caught the execption to provide this reflection for you. It allows your to gather metrics and details about the error. Those details allow you to act on it as you see fit.
on.execution_failed do |job_hash|
logger.warn(job_hash.merge(message: "Execution failed"))
end

# Failed to acquire lock in a timely fashion
on.lock_failed do |job_hash|
logger.warn(job_hash.merge(message: "Lock failed"))
end

# In case you want to collect metrics
on.locked do |job_hash|
logger.debug(job_hash.merge(message: "Lock success"))
end

# When your conflict strategy is to reschedule and it failed
on.reschedule_failed do |job_hash|
logger.debug(job_hash.merge(message: "Reschedule failed"))
end

# When your conflict strategy is to reschedule and it failed
# Mostly for metrics I guess
on.rescheduled do |job_hash|
logger.debug(job_hash.merge(message: "Reschedule success"))
end

# You asked to wait for a lock to be achieved but we timed out waiting
on.timeout do |job_hash|
logger.warn(job_hash.merge(message: "Oh no! Timeout!! Timeout!!"))
end

# The current worker isn't part of this sidekiq servers workers
on.unknown_sidekiq_worker do |job_hash|
logger.warn(job_hash.merge(message: "WAT!? Why? What is this worker?"))
end

# Unlock failed! Not good
on.unlock_failed do |job_hash|
logger.warn(job_hash.merge(message: "Unlock failed"))
end

# Unlock was successful, perhaps mostly interesting for metrics
on.unlocked do |job_hash|
logger.warn(job_hash.merge(message: "Unlock success"))
end
```

You don't need to configure them all. Some of them are just informational, some of them more for metrics and a couple of them (failures, timeouts) might be of real interest.

I leave it up to you to decided what to do about it.

0 comments on commit 84abb58

Please sign in to comment.