Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add typedocs for Worker.return/0 #1108

Merged
merged 6 commits into from
Jun 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions lib/oban/worker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,22 @@ defmodule Oban.Worker do
alias Oban.{Backoff, Job, Validation}

@type t :: module()

@typedoc """
Return values control whether a job is treated as a success or a failure.

- `:ok` - the job is successful and marked as `completed`.
- `{:ok, ignored}` - the job is successful, marked as `completed`, and the return value is ignored.
- `{:cancel, reason}` - the job is marked as `cancelled` for the provided reason and no longer retried.
- `{:error, reason}` - the job is marked as `retryable` for the provided reason, or `discarded`
if it has exhausted all attempts.
- `{:snooze, seconds}` - mark the job as `scheduled` to run again `seconds` in the future.

> #### Deprecated {: .warning}
>
> - `:discard` - deprecated, use `{:cancel, reason}` instead.
> - `{:discard, reason}` - deprecated, use `{:cancel, reason}` instead.
"""
@type result ::
:ok
| :discard
Expand Down
Loading