Comments (6)
Well if there is no jid returned then the job was most likely a duplicate and you could inform the user about the duplicate. Regarding how to do that exactly (I suppose you would like to mention what user is currently using the API) that is not something easily achieved with Sidekiq.
unless MyAPIConsumer.perform_async(company_id: 1)
# notify user about that API is in use from another user
end
If you want to keep track of who checks out the API then I recommend to use some type real database where you store these things on your side. It would be possible for the gem to collect that information for you using lua scripts but it isn't exactly straight forward with redis.
from sidekiq-unique-jobs.
Check the readme https://github.com/mhenrixon/sidekiq-unique-jobs#logging
from sidekiq-unique-jobs.
Hm, logging is good, but what if I want to notify the user that the action they have tried failed? I mean, checking returned jid
is fine if it is the recommended way. But maybe there is another way to check?
from sidekiq-unique-jobs.
@ivanovv could you elaborate on your needs? It is possible to use the sidekiq_retries_exhausted
for some things. Also, the death_notifications
in sidekiq could be used for some things.
from sidekiq-unique-jobs.
@ivanovv could you elaborate on your needs?
@mhenrixon sure!
We have a process that uses external API to buy a resource for a company. Company has many users and one resource. We don't want users to be able to start a buying process if there is already one scheduled or running. At the same time we would like to notify a user that their attempt to buy a resource has failed. Make sense?
from sidekiq-unique-jobs.
Thanks a lot @mhenrixon!
I don't really care about the user holding the lock, simple notification that the operation is in progress will be sufficient.
Will create a PR with changes to README later as it was quite a task to find that information in the repo :)
from sidekiq-unique-jobs.
Related Issues (20)
- concurrent-ruby 1.1.10 spikes volume of jobs HOT 8
- Ambiguity about `death_handers`
- DEPRECATION WARNING: default_worker_options is deprecated and will be removed from Sidekiq 7.0 (use default_job_options instead) (called from notify_agents at /Users/hackeron/Development/Tether/timeline/app/models/user.rb:303) HOT 3
- Reviwing: Failed jobs waiting to be retried are not considered when fetching uniqueness
- Unexpected behavior with until_and_while_executing HOT 4
- Disable logging in Rails testing HOT 7
- Unique Jobs Not Running with Version 7.1.26 HOT 12
- spammed by `Nothing to delete; exiting` during spec HOT 2
- Jobs are being allowed to run even though there is a lock HOT 8
- Locks can't be found in UI? HOT 6
- Incompatibility with Sidekiq 7 HOT 12
- Job executed twice when reaper runs
- Error "undefined method `redis_info' for Sidekiq:Module" on upgrade HOT 2
- Using rspec matcher and getting: `NameError: uninitialized constant SidekiqUniqueJobs::Lock::BaseLock::Validator`
- until and while executing with different arguments for client/server HOT 2
- Got often got Limit exceeded message in changelog HOT 6
- Unlock jobs when queue is deleted HOT 2
- Allow one running job but at most one job in the queue HOT 2
- while_executing jobs being dropped HOT 4
- Support for redis 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sidekiq-unique-jobs.