Skip to content

JScott/stubborn_queue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stubborn_queue

Sometimes you want to make sure that stuff on your queue gets done. This stubborn queue will insist that something isn't done until you tell it otherwise. Unfinished items get requeued after a specified amount of time because you didn't do it right. I store the data in file to avoid dependencies outside of Ruby itself.

Usage

important_data = StubbornQueue.new name: 'important_data', timeout: 60
length = important_data.enqueue 'top secret!'
id = important_data.dequeue
data = important_data.lookup id
do_something_with data
important_data.finish id

If do_something_with takes longer than 60 seconds, it'll assume that you crashed out and requeue it for another worker.

Heads up!

This is in no way inherently thread- or process-safe. It's built for one process owning one queue file and not interacting with it asynchronously.

Special thanks

Huge props to Chris Olstrom who helped me understand the idea and was a good sport when I made my own implementation which will probably be extremely similar to his.

About

Queueing that keeps on kicking until you tell it to stop.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages