joakimk / toniq

Simple and reliable background job processing library for Elixir.
http://toniq.elixir.pm/
340 stars 25 forks source link

Introduce the concept of delayed jobs #28

Closed safwank closed 7 years ago

safwank commented 8 years ago

As per our conversation, here's a summary of how it works:

  1. You can queue a job with a delay by calling Toniq.enqueue_with_delay/3
  2. The delay can be for a specific period (in milliseconds) or indefinite (:infinity)
  3. There's a GenServer called DelayedJobTracker that tracks delayed jobs and flushes them when they expire
  4. You can also optionally flush all delayed jobs regardless of whether they've expired or not

I'll update the README once you've accepted the PR.

safwank commented 7 years ago

@joakimk Bueller? :)

joakimk commented 7 years ago

I've finally got around to reviewing all this. Looks great.

Merged it in and added a readme section and credits to you for this feature.

I found one bug though when testing this manually and doing recovery of old jobs after a restart. I've fix that one in https://github.com/joakimk/toniq/commit/d9174ee273cae20945f438df9bb24cc1860ea1a7.

Since it adds a feature without breaking the existing API (as far as I can see), I bumped the middle version and released it as 1.2.0.

joakimk commented 7 years ago

Is this your twitter handle? https://twitter.com/safwandoterl

I thought I'd mention you in a tweet about toniq 1.2.0 if that's ok?

safwank commented 7 years ago

Oh, awesome!

I found one bug though when testing this manually and doing recovery of old jobs after a restart. I've fix that one in d9174ee.

Really good catch!

I thought I'd mention you in a tweet about toniq 1.2.0 if that's ok?

Sure.