Giter Site home page Giter Site logo

Comments (6)

niemyjski avatar niemyjski commented on June 12, 2024

If you want to clear the queue you could call DeleteQueueAsync() but make sure you check the underlying implementation as it may completely delete the queue + configuration. We do this for our unit tests. Also you could always add a setting to your queue job and then look at that setting in dequeue to auto complete a queue entry.

from foundatio.

paulreicherdt avatar paulreicherdt commented on June 12, 2024

The question was - how to cancel an already running job (queue entry). So, usually, I would use CancellationTokenSource, create a CancellationToken, link it with others if necessary and then, I'm able to monitor this token and stop the job if cancellation were requested.

from foundatio.

niemyjski avatar niemyjski commented on June 12, 2024

I think what you are doing is the recommended way. @ejsmith, it might be nice to trigger the cancellation token we pass through to get cancelled from the passed in context?

from foundatio.

ejsmith avatar ejsmith commented on June 12, 2024

Yeah, not sure exactly. When you call dequeue it takes a cancellationtoken that can be cancelled to stop the processing as long as you are checking in your long running code for it to be cancelled periodically.

from foundatio.

paulreicherdt avatar paulreicherdt commented on June 12, 2024

Yes, sure, I need to check the cancellation token periodically. I do it. And using cancellation token I'm able to cancel my job on any place. Or even within .net library code.
I have seen, that there is a cancellation token within job context. So, it may be a nice solution - to cancel all queued jobs by cancelling from the queue.

from foundatio.

paulreicherdt avatar paulreicherdt commented on June 12, 2024

Also, the possibility to disable a job would be nice. By e.g. instance count set to 0.

from foundatio.

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.