Comments (4)
Hey all,
Sorry for the delay. To give you some background, this project started as a port of Sidekiq to golang. The internals work almost identically. The fetcher in go-workers uses the "reliable_fetch" style as described in Sidekiq's documentation: https://github.com/mperham/sidekiq/wiki/Reliability.
To summarize:
When an instance fetches a message from redis, it uses redis's rpoplpush
command to atomically remove the message from the queue and place it in an inprogress queue. This helps to make sure the message isn't lost if say, your go-workers process dies, etc.
The inprogress queue key is generated based on the unique process ID you pass into workers.Configure
(shown in the README).
That operation is atomic (assuming the Redis instance doesn't die before persisting the change to disk), and any other process fetching messages will not retrieve the same message.
Once the job finishes, go-workers removes the message from the inprogress queue and fetches another message.
When an instance starts, it first looks at the inprogress queue to see if there are any messages which weren't completed (due to a crash, etc). If there are messages in the inprogress queue, it'll being processing them.
IF you are running multiple instances and passing the same process ID into workers.Configure
, then each would view messages that are inprogress from another instance as messages it should process again.
If you aren't, then there are no known issues regarding duplicate job processing (in fact, most of the protections for reliable, unique enqueuing/dequeuing is left up to the redis instance itself!).
If you're still seeing weird behavior and can narrow it down to a test case I can reproduce, then I'd be happy to take a look and help debug!
Thanks,
John
from go-workers.
I suspect the issue arises from here:
https://github.com/jrallison/go-workers/blob/master/worker.go#L32-L34
if w.process(message) {
w.manager.confirm <- message
}
If this is a blocking message then the job would remain in the queue until the work is done. Am I reading that correctly?
from go-workers.
IF you are running multiple instances and passing the same process ID into workers.Configure, then each would view messages that are inprogress from another instance as messages it should process again.
thanks @jrallison, I'll bet that's exactly what it is. I had the process id hard coded. Will try it out with dynamic ID based on worker number.
from go-workers.
as @maccman just yelled from across the room "the problem was between keyboard and chair"
from go-workers.
Related Issues (20)
- Pass Redis connection Configure
- queue is not FIFO, but LIFO actually.. HOT 1
- Unnecessary logic in func EnqueueWithOptions
- gospec moved to github.com/customerio/gospec/src/gospec
- What's the meaning of "Class" property in EnqueueData? HOT 3
- How to use enqueue_in (from ruby TO go) HOT 1
- Configuring multiple REDIS servers HOT 3
- Retry options HOT 2
- need more guides HOT 1
- Scheduled jobs being "lost" HOT 2
- Run jobs synchronously
- Retry Jobs Not Showing in Sidekiq Retry List in Web UI HOT 1
- Contributors HOT 3
- Monitoring worker
- Enqueue using a Redis pipeline?
- EnqueueIn and EnqueueWithOptions with At
- ActiveJob Issues
- Error & Retry
- question: support for go modules
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 go-workers.