Skip to content

Commit 5a54979

Browse files
authored
Revise timer examples and duration specification
Updated timer usage examples and clarified duration specification.
1 parent 929b2de commit 5a54979

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

docs/features/timers.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,14 @@ class MyWorkflow extends Workflow
1818
{
1919
public function execute()
2020
{
21-
// Wait for 5 seconds before continuing
22-
yield timer(5);
21+
yield timer('5 seconds');
2322

24-
// Do something after the timer has finished
25-
return 'Hello world';
23+
return 'The workflow waited 5 seconds.';
2624
}
2725
}
2826
```
2927

30-
You may also specify the time to wait as a string e.g. '5 seconds', '30 minutes' or even '3 days'. Laravel Workflow can handle any duration.
28+
You can specify the `$duration` as an integer number of seconds or as a string e.g. '5 seconds', '30 minutes' or even '3 days'. Laravel Workflow can handle any duration.
3129

3230
**Important:** Inside of a workflow, never use `Carbon::now()` or Laravel's `now()` to get the current time. Instead, use `Workflow\now()`, which returns the current time as seen by the workflow system. This is crucial because the actual time may not match your application's system clock.
3331

0 commit comments

Comments
 (0)