edgurgel / verk

A job processing system that just verks! 🧛‍
https://hex.pm/packages/verk
MIT License
723 stars 65 forks source link

Unable to overwrite `max_retry_count` via config.exs #170

Closed tinenbruno closed 5 years ago

tinenbruno commented 6 years ago

Hello!

I started integrating with Verk today and I am having some issues with max_retry_count. Apparently, Verk.Job is always setting the default max_retry_count to 25.

I tried to Confex.get_env{:verk, :max_retry_count) on my app and it returned the correct value, however running Verk.Job.default_max_retry_count is returning 25.

For now the workaround is to set the max_retry_count on every job I run, but it would be better if I could set a default value.

edgurgel commented 6 years ago

From Verk.Job

 @default_max_retry_count Confex.get_env(:verk, :max_retry_count, 25)
  @keys [error_message: nil, failed_at: nil, retry_count: 0, queue: nil, class: nil, args: [],
         jid: nil, finished_at: nil, enqueued_at: nil, retried_at: nil, created_at: nil, error_backtrace: nil,
max_retry_count: @default_max_retry_count]

So yeah, it's using the max_retry_count during compilation not during execution!

We should probably set this to be nil by default and populate when decoded/encoded ? 🤔

edgurgel commented 6 years ago

Another workaround is to always pass max_retry_count: nil when creating a new job. It should fetch the config when Verk.enqueue runs