Comments (6)
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.
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.
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.
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.
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.
Also, the possibility to disable a job would be nice. By e.g. instance count set to 0.
from foundatio.
Related Issues (20)
- Change metrics abstraction to be more performant
- Inconsistent cache descriptions in README HOT 1
- How to delete pattern HOT 3
- cron jobs HOT 3
- CacheLockProvider throws format exception when it fails to acquire lock and trace logging is enabled HOT 1
- [RedisQueue] StartWorkingImpl worker loop throws unhandled exception in task which prevents further queue processing HOT 14
- InMemoryCacheClient Maximum Size HOT 5
- Kafka consumer throughput. Usage of KafkaMessageBusOptions.DefaultConsumerThreadCount HOT 3
- publishAsync immediately returns when awaited HOT 4
- Feature Request : Priority Queues HOT 2
- InMemoryCacheClient SetAllAsync doesn't respect Expiry HOT 1
- GetFileListAsync - searchPattern
- Unified messaging HOT 1
- Upgrade Deprecated Azure SDK Clients HOT 6
- Split Foundatio.Extensions.Hosting in two HOT 4
- DataDictionary.Empty is not protected by potential bugs. HOT 3
- Throw exceptions on IFileStorage instead of returning false or null. HOT 4
- the question of Foundatio.Lock.ILockProvider HOT 3
- [Not a Bug] Discord Channel? I want to commit some example code HOT 1
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 foundatio.