Skip to content

Commit

Permalink
Note that worker options are compile-time only
Browse files Browse the repository at this point in the history
Closes #905
  • Loading branch information
sorentwo committed Jun 1, 2023
1 parent 4fb8940 commit 90553d0
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ defmodule MyApp.Business do
end
```

The `use` macro also accepts options to customize max attempts, priority, tags,
and uniqueness:
The `use` macro also accepts options to customize `max_attempts`, `priority`, `tags`, and `unique`
options:

```elixir
defmodule MyApp.LazyBusiness do
Expand All @@ -290,12 +290,20 @@ defmodule MyApp.LazyBusiness do
end
```

Successful jobs should return `:ok` or an `{:ok, value}` tuple. The value
returned from `perform/1` is used to control whether the job is treated as a
success, a failure, cancelled or deferred for retrying later.
Like all `use` macros, options are defined at compile time. Avoid using `Application.get_env/2` to
define worker options. Instead, pass dynamic options at runtime by passing them to
`MyWorker.new/2`:

See the `Oban.Worker` docs for more details on failure conditions and
`Oban.Telemetry` for details on job reporting.
```elixir
MyApp.MyWorker.new(args, queue: dynamic_queue)
```

Successful jobs should return `:ok` or an `{:ok, value}` tuple. The value returned from
`perform/1` is used to control whether the job is treated as a success, a failure, cancelled or
deferred for retrying later.

See the `Oban.Worker` docs for more details on failure conditions and `Oban.Telemetry` for details
on job reporting.

## Enqueueing Jobs

Expand Down

0 comments on commit 90553d0

Please sign in to comment.