@@ -101,7 +101,7 @@ The :class:`Symfony\\Component\\Scheduler\\Attribute\\AsSchedule` attribute,
101
101
which by default references the schedule named ``default ``, allows you to register
102
102
on a particular schedule::
103
103
104
- // src/Scheduler/MyScheduleProvider .php
104
+ // src/Scheduler/SaleTaskProvider .php
105
105
namespace App\Scheduler;
106
106
107
107
#[AsSchedule]
@@ -268,7 +268,7 @@ Then, define your recurring message::
268
268
269
269
Finally, the recurring messages has to be attached to a schedule::
270
270
271
- // src/Scheduler/MyScheduleProvider .php
271
+ // src/Scheduler/SaleTaskProvider .php
272
272
namespace App\Scheduler;
273
273
274
274
#[AsSchedule('uptoyou')]
@@ -344,15 +344,25 @@ recurring messages. You can narrow down the list to a specific schedule:
344
344
Efficient management with Symfony Scheduler
345
345
-------------------------------------------
346
346
347
- If a worker becomes idle, the recurring messages won't be generated (because they
348
- are created on-the-fly by the scheduler transport).
347
+ When a worker is restarted or undergoes shutdown for a period, the Scheduler
348
+ transport won't be able to generate the messages (because they are created
349
+ on-the-fly by the scheduler transport). This implies that any messages
350
+ scheduled to be sent during the worker's inactive period are not sent, and the
351
+ Scheduler will lose track of the last processed message. Upon restart, it will
352
+ recalculate the messages to be generated from that point onward.
353
+
354
+ To illustrate, consider a recurring message set to be sent every 3 days. If a
355
+ worker is restarted on day 2, the message will be sent 3 days from the restart,
356
+ on day 5.
357
+
358
+ While this behavior may not necessarily pose a problem, there is a possibility
359
+ that it may not align with what you are seeking.
349
360
350
361
That's why the scheduler allows to remember the last execution date of a message
351
362
via the ``stateful `` option (and the :doc: `Cache component </components/cache >`).
352
- This way, when it wakes up again, it looks at all the dates and can catch up on
353
- what it missed::
363
+ This allows the system to retain the state of the schedule, ensuring that when a worker is restarted, it resumes from the point it left off.::
354
364
355
- // src/Scheduler/MyScheduleProvider .php
365
+ // src/Scheduler/SaleTaskProvider .php
356
366
namespace App\Scheduler;
357
367
358
368
#[AsSchedule('uptoyou')]
@@ -374,7 +384,7 @@ To scale your schedules more effectively, you can use multiple workers. In such
374
384
cases, a good practice is to add a :doc: `lock </components/lock >` to prevent the
375
385
same task more than once::
376
386
377
- // src/Scheduler/MyScheduleProvider .php
387
+ // src/Scheduler/SaleTaskProvider .php
378
388
namespace App\Scheduler;
379
389
380
390
#[AsSchedule('uptoyou')]
@@ -403,7 +413,7 @@ your message in a :class:`Symfony\\Component\\Messenger\\Message\\RedispatchMess
403
413
This allows you to specify a transport on which your message will be redispatched
404
414
before being further redispatched to its corresponding handler::
405
415
406
- // src/Scheduler/MyScheduleProvider .php
416
+ // src/Scheduler/SaleTaskProvider .php
407
417
namespace App\Scheduler;
408
418
409
419
#[AsSchedule('uptoyou')]
0 commit comments