Skip to content

Raise unexpected type error for lock ttl#884

Merged
mhenrixon merged 2 commits intomhenrixon:mainfrom
tazoo:raise_unexpected_type_error_for_lock_ttl
Jun 13, 2025
Merged

Raise unexpected type error for lock ttl#884
mhenrixon merged 2 commits intomhenrixon:mainfrom
tazoo:raise_unexpected_type_error_for_lock_ttl

Conversation

@tazoo
Copy link
Copy Markdown
Contributor

@tazoo tazoo commented Jun 13, 2025

fix for #882

ArgumentError is now raised if lock_ttl is an unexpected type.
Also, the README has been modified accordingly.

This change is to prevent returning nil with an unexpected type and tying up the lock.

tazoo added 2 commits June 13, 2025 18:53
Copy link
Copy Markdown
Owner

@mhenrixon mhenrixon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great addition!

@mhenrixon mhenrixon merged commit fff3f7d into mhenrixon:main Jun 13, 2025
27 of 28 checks passed
@luis30n
Copy link
Copy Markdown
Contributor

luis30n commented Aug 5, 2025

@mhenrixon sorry to bother.
The lock_ttl integer enforcement was unintentionally introduced at #879 so if some codebases (like mine) have lock_ttl: Duration, lots of jobs would have acquired never expiring locks by now.
I'm preparing a script to clean them up for my company and I was wondering if you'd consider it worth of having a rake task to help others with this cleanup.
Let me know what you think

mike3985 added a commit to alphagov/publishing-api that referenced this pull request Dec 4, 2025
Apparently (mhenrixon/sidekiq-unique-jobs#882,
mhenrixon/sidekiq-unique-jobs#884 (comment))
SidekiqUniqueJobs version 8.0.11 seems to have accidentally dropped
support for defining lock_ttl as an ActiveSupport::Duration. We do that.
And we updated to version 8.0.11 on 27th May this year
(#3364).

We've been seeing an increase in problems with stale SidekiqUniqueJobs
locks these past few months and believed that we'd only just noticed the
problem recently because of digging deeper into the issue. I guess
there's a chance that this change is the source of those problems?

Either way, apprently it needs fixing so now we'll use an integer
representing seconds, which SidekiqUniqueJobs definitely supports.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants