Giter Club home page Giter Club logo

Comments (6)

mhenrixon avatar mhenrixon commented on August 17, 2024 1

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.

mhenrixon avatar mhenrixon commented on August 17, 2024

Check the readme https://github.com/mhenrixon/sidekiq-unique-jobs#logging

from sidekiq-unique-jobs.

ivanovv avatar ivanovv commented on August 17, 2024

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.

mhenrixon avatar mhenrixon commented on August 17, 2024

@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 avatar ivanovv commented on August 17, 2024

@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.

ivanovv avatar ivanovv commented on August 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.