Skip to content

Commit 12c9343

Browse files
Add documentation about many schedules using same job with onOneServer (laravel#8090)
* Add documentation about many schedules using same job with onOneServer option * Update scheduling.md Co-authored-by: Taylor Otwell <[email protected]>
1 parent a9caab1 commit 12c9343

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

scheduling.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,23 @@ To indicate that the task should run on only one server, use the `onOneServer` m
278278
->at('17:00')
279279
->onOneServer();
280280

281+
<a name="naming-unique-jobs"></a>
282+
#### Naming Single Server Jobs
283+
284+
Sometimes you may need to schedule the same job to be dispatched with different parameters, while still instructing Laravel to run each permutation of the job on a single server. To accomplish this, you may assign each schedule definition a unique name via the `name` method:
285+
286+
```php
287+
$schedule->job(new CheckUptime('https://laravel.com'))
288+
->name('check_uptime:laravel.com')
289+
->everyFiveMinutes()
290+
->onOneServer();
291+
292+
$schedule->job(new CheckUptime('https://vapor.laravel.com'))
293+
->name('check_uptime:vapor.laravel.com')
294+
->everyFiveMinutes()
295+
->onOneServer();
296+
```
297+
281298
<a name="background-tasks"></a>
282299
### Background Tasks
283300

0 commit comments

Comments
 (0)