-
-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |