sorentwo/oban

Minor documentation clarification for Oban.Worker and Oban.Pro.Worker

Closed this issue · 1 comments

Is your feature request related to a problem? Please describe.

We accidentally used Application.get_env to fetch a value that is injected at runtime inside of Oban.Pro worker initialization, something similar to the following: use Oban.Pro.Worker, queue: Application.get_env(...),. It was working in the past, but seemed to have stopped working as intended recently.

Describe the Solution You'd Like

Update the documentation for Oban worker initialization to state that values provided to the Oban.Pro.Worker or Oban.Worker should only be compile time values, and note how you recommend constructing values like queue names using runtime environment values. I assume you would recommend building queue names at runtime by passing the queue as a parameter to the Worker.new() function and not specifying anything in the "use" statement.

Describe Alternatives You've Considered

Just fix our usage in our codebase and don't request any documentation update

The runtime vs. compile time differences for module attributes, including those set by use, can be confusing. Your proposed solution is spot on (in fact, I'd use what you wrote with some rephrasing and an example or two 😉).

A PR is welcome; otherwise, I'll get to this soon!