From 069357b9809ba2b35f81777b06456627f6f985f5 Mon Sep 17 00:00:00 2001 From: Yordis Prieto Date: Fri, 21 Jun 2024 13:15:29 -0400 Subject: [PATCH 1/5] chore: improve docs --- lib/oban/worker.ex | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/oban/worker.ex b/lib/oban/worker.ex index 9cfbf0ba..c1bec8b3 100644 --- a/lib/oban/worker.ex +++ b/lib/oban/worker.ex @@ -257,6 +257,20 @@ defmodule Oban.Worker do alias Oban.{Backoff, Job, Validation} @type t :: module() + + @typedoc """ + - `:ok` - the job was successfully processed. + - `{:ok, ignored}` - the job was processed successfully, the return value is + ignored. + - `{:cancel, reason}` - the job was canceled with a reason. + - `{:error, reason}` - the job failed with a reason. + - `{:snooze, seconds}` - the job should be retried after `seconds`. + + > #### Error {: .warning} + > + > - `:discard` - deprecated, use `{:cancel, reason}` or {:error, reason} instead. + > - `{:discard, reason}` - deprecated, use `{:cancel, reason}` or {:error, reason} instead. + """ @type result :: :ok | :discard From 2719d9cfb9a1b1de0a7d8e44a241e99f7a4f10c8 Mon Sep 17 00:00:00 2001 From: Parker Selbert Date: Fri, 21 Jun 2024 12:48:05 -0500 Subject: [PATCH 2/5] Apply suggestions from code review --- lib/oban/worker.ex | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/oban/worker.ex b/lib/oban/worker.ex index c1bec8b3..da43aa88 100644 --- a/lib/oban/worker.ex +++ b/lib/oban/worker.ex @@ -259,17 +259,19 @@ defmodule Oban.Worker do @type t :: module() @typedoc """ - - `:ok` - the job was successfully processed. - - `{:ok, ignored}` - the job was processed successfully, the return value is - ignored. - - `{:cancel, reason}` - the job was canceled with a reason. - - `{:error, reason}` - the job failed with a reason. - - `{:snooze, seconds}` - the job should be retried after `seconds`. - - > #### Error {: .warning} + 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 stop retrying it. + - `{: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}` or {:error, reason} instead. - > - `{:discard, reason}` - deprecated, use `{:cancel, reason}` or {:error, reason} instead. + > - `:discard` - deprecated, use `{:cancel, reason}` instead. + > - `{:discard, reason}` - deprecated, use `{:cancel, reason}` instead. """ @type result :: :ok From 5a2c77665ef5d937cd6094a86640d57ee3ad2b9c Mon Sep 17 00:00:00 2001 From: Parker Selbert Date: Fri, 21 Jun 2024 12:48:43 -0500 Subject: [PATCH 3/5] Update lib/oban/worker.ex --- lib/oban/worker.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/oban/worker.ex b/lib/oban/worker.ex index da43aa88..a49073eb 100644 --- a/lib/oban/worker.ex +++ b/lib/oban/worker.ex @@ -263,7 +263,7 @@ defmodule Oban.Worker do - `: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 stop retrying it. + - `{: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. From e0987ef6ec7d07ff57eea9d61fe8d8a776cf4136 Mon Sep 17 00:00:00 2001 From: Parker Selbert Date: Fri, 21 Jun 2024 12:55:53 -0500 Subject: [PATCH 4/5] Update lib/oban/worker.ex --- lib/oban/worker.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/oban/worker.ex b/lib/oban/worker.ex index a49073eb..9221b7d5 100644 --- a/lib/oban/worker.ex +++ b/lib/oban/worker.ex @@ -260,7 +260,7 @@ defmodule Oban.Worker do @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. From de757009e16d817c38575cb6b566affdc65f78f0 Mon Sep 17 00:00:00 2001 From: Yordis Prieto Date: Fri, 21 Jun 2024 13:55:56 -0400 Subject: [PATCH 5/5] fix format --- lib/oban/worker.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/oban/worker.ex b/lib/oban/worker.ex index a49073eb..9221b7d5 100644 --- a/lib/oban/worker.ex +++ b/lib/oban/worker.ex @@ -260,7 +260,7 @@ defmodule Oban.Worker do @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.