-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2552fba
commit d8f1fc5
Showing
3 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
gitbook/docs/managing-jobs/manually-working/repeatevery-5.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# SetShouldSaveResult | ||
|
||
|
||
|
||
## `job.setShouldSaveResult(shouldSaveResult)` | ||
|
||
{% hint style="info" %} | ||
The `setShouldSaveResult` method sets a flag indicating whether the outcome of the job's execution should be persisted in the database. This option is useful for managing storage and performance by selectively saving results only when necessary. | ||
|
||
\ | ||
_This does **NOT** save the job in the database. you must explicitly declare_ [_`save()`_](save.md)_if you want to save it_ | ||
{% endhint %} | ||
|
||
### Example Usage | ||
|
||
{% code fullWidth="false" %} | ||
```typescript | ||
job.setShouldSaveResult(true); | ||
await job.save(); | ||
``` | ||
{% endcode %} | ||
|
||
### Parameters | ||
|
||
* **`shouldSaveResult`** (`boolean`): A boolean flag that determines if the job’s result should be saved upon completion. Setting this to `true` enables result persistence, while `false` disables it. | ||
|
||
\ | ||
|
||
|
||
### Returns | ||
|
||
* **`Job`**: Returns the job instance, allowing for method chaining. | ||
|
||
\ | ||
|
||
|
||
\ | ||
|
||
|
||
\ | ||
|
||
|
||
|
||
|
44 changes: 44 additions & 0 deletions
44
gitbook/docs/managing-jobs/manually-working/repeatevery-6.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Fail | ||
|
||
|
||
|
||
## `job.fail(reason)` | ||
|
||
{% hint style="info" %} | ||
The `fail` method marks a job as failed and updates its attributes accordingly. It records the reason for failure, increments the failure count, and, if the job configuration permits, schedules the job for a retry based on the specified backoff strategy. | ||
|
||
\ | ||
_This does **NOT** save the job in the database. you must explicitly declare_ [_`save()`_](save.md)_if you want to save it_ | ||
{% endhint %} | ||
|
||
### Example Usage | ||
|
||
{% code fullWidth="false" %} | ||
```typescript | ||
job.fail(new Error('Unable to connect to database')); | ||
await job.save(); | ||
``` | ||
{% endcode %} | ||
|
||
### Parameters | ||
|
||
* **`reason`** (`string | Error`): The reason for the job's failure, which can be provided as either a string or an Error object. If an Error object is provided, its message is used as the failure reason. | ||
|
||
\ | ||
|
||
|
||
### Returns | ||
|
||
* **`Job`**: Returns the job instance, allowing for method chaining. This enables further actions or logging after the failure is recorded. | ||
|
||
\ | ||
|
||
|
||
\ | ||
|
||
|
||
\ | ||
|
||
|
||
|
||
|
d8f1fc5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pulse Test Report