Skip to content

Commit

Permalink
Use snippet instead of inline text
Browse files Browse the repository at this point in the history
  • Loading branch information
Isengo1989 committed Dec 16, 2024
1 parent 41cd044 commit b7ad999
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
8 changes: 1 addition & 7 deletions guides/hosting/infrastructure/scheduled-task.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,4 @@ bin/console messenger:consume scheduler_shopware
On startup of this command reads the `scheduled_task` database table and applies the stored intervals, an entry in this table is optional. In the event that these intervals are modified in the database, it is necessary to restart the command for the updated intervals to take effect.
To deactivate tasks, set status to `Shopware\Core\Framework\MessageQueue\ScheduledTask\ScheduledTaskDefinition::STATUS_INACTIVE` in this table, and restart the `consume` command.

## Debugging scheduled tasks

You can directly run a single scheduled task without the queue. This is useful for debugging purposes or to have better control of when and which tasks are executed. You can use `bin/console scheduled-task:run-single <task-name>` to run a single task. Example:

```shell
bin/console scheduled-task:run-single log_entry.cleanup
```
<!--@include: @/docs/snippets/guide/debugging_scheduled_tasks.md-->
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ In order to properly test your scheduled task, you first have to run the command

Now you still need to run the command `bin/console messenger:consume` to actually execute the dispatched messages. Make sure, that the `status` of your scheduled task is set to `scheduled` in the `scheduled_task` table, otherwise it won't be executed. This is not necessary, when you're using the admin worker.

<!--@include: @/docs/snippets/guide/debugging_scheduled_tasks.md-->

## More interesting topics

* [Adding a custom command](add-custom-commands)
7 changes: 7 additions & 0 deletions snippets/guide/debugging_scheduled_tasks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Debugging scheduled tasks

You can directly run a single scheduled task without the queue. This is useful for debugging purposes or to have better control of when and which tasks are executed. You can use `bin/console scheduled-task:run-single <task-name>` to run a single task. Example:

```shell
bin/console scheduled-task:run-single log_entry.cleanup
```

0 comments on commit b7ad999

Please sign in to comment.