samsondav / rihanna

Rihanna is a high performance postgres-backed job queue for Elixir
MIT License
439 stars 47 forks source link

Feature Request: Graceful shutdown with worker draining #18

Open lpil opened 6 years ago

lpil commented 6 years ago

It would be great if when the application is shutting down a period of time is given for the workers to finish.

If the workers finish within the grace time the application continues shutting down, if they do not they are killed and then shut down continues.

Here's an example of how I implemented this in Exq: https://github.com/akira/exq/pull/271/files

I may be up for implementing this at a later date :)

samsondav commented 6 years ago

@lpil Thanks for this feature request! I can't imagine it would be that hard to do, it would be a great place if you wanted to start getting involved in Rihanna development :)

lpil commented 6 years ago

If I start using Rihanna I'll probably implement it. We'll see what happens in the coming months :)

lpil commented 5 years ago

Looks like I've finally got a Rihanna shaped problem so I'll do this one after https://github.com/samphilipd/rihanna/issues/38

samsondav commented 5 years ago

@lpil did you ever get anywhere with this? I think it would be a rather nice feature. I looked into it before but I actually couldn't figure out how to find out if the BEAM is about to terminate inside the GenServer. Do you have any ideas about that?

lpil commented 5 years ago

Gleam distracted me I'm afraid.

This is how I implemented this feature within another library -> https://github.com/akira/exq/pull/271/files