Comments (3)
I think you should use this middleware to wrap your enqueuer: https://pkg.go.dev/github.com/taylorchu/[email protected]/middleware/unique.
It maps a job into a unique key and a unique duration.
The way how you did it will have race conditions.
from work.
Thank you so much for the fast response! The issue is, we have varying jobs already in existence that will require different unique durations (i.e. the cron job above runs daily, but others run every 3 days). Is there a non-duration solution? For example, is it possible to just base it off of whether the job ID is unique and whether a job with that same ID is currently in the queue?
Or if we are going about this incorrectly, what is the best way to proceed?
from work.
uniq function can switch by enqueue options https://pkg.go.dev/github.com/taylorchu/[email protected]#EnqueueOptions too.
from work.
Related Issues (20)
- Unique EnqueueMiddleware example HOT 2
- Catch Panic Middleware HOT 1
- Worker loop is a busy loop HOT 1
- Is this abandoned? HOT 6
- Job's MaxExecutionTime option does not work HOT 4
- support "job group" like sidekiq batch
- [QUESTION] Does the reaper still exist? HOT 1
- [QUESTION] How to assign priority to job/task HOT 1
- [REQUEST] Create a new release HOT 1
- custom ratelimit middleware HOT 1
- Latest master version has no tag HOT 1
- Ability to retry dead jobs manually HOT 3
- Update github.com/go-redis/redis/v7 to v8 HOT 2
- Merge this into gocraft/work HOT 4
- Lost job HOT 6
- Is it still in prototype stage? HOT 4
- ContextJobFunc and HeartbeatMiddleware incompatible? HOT 5
- Backward compatibility w/ work v1 HOT 1
- Is UI similar to Web UI in gocraft/work upcoming? HOT 3
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 work.