Skip to content

Commit

Permalink
GITBOOK-34: No subject
Browse files Browse the repository at this point in the history
  • Loading branch information
code-xhyun authored and gitbook-bot committed May 9, 2024
1 parent 2552fba commit d8f1fc5
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gitbook/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@
* [Remove](docs/managing-jobs/manually-working/repeatevery-2.md)
* [Priority](docs/managing-jobs/manually-working/repeatevery-3.md)
* [Touch](docs/managing-jobs/manually-working/repeatevery-4.md)
* [SetShouldSaveResult](docs/managing-jobs/manually-working/repeatevery-5.md)
* [Fail](docs/managing-jobs/manually-working/repeatevery-6.md)
44 changes: 44 additions & 0 deletions gitbook/docs/managing-jobs/manually-working/repeatevery-5.md
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 gitbook/docs/managing-jobs/manually-working/repeatevery-6.md
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.

\


\


\




1 comment on commit d8f1fc5

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines Statements Branches Functions
Coverage: 51%
53.65% (543/1012) 38.79% (116/299) 46.79% (73/156)

Pulse Test Report

Tests Skipped Failures Errors Time
45 0 💤 0 ❌ 0 🔥 8.692s ⏱️

Please sign in to comment.