Skip to content

Commit

Permalink
docs: document @Cron task decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeshultz committed Feb 23, 2024
1 parent 9e22daf commit 7af65d8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/userguides/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ Inside of `handle_token_transfer_events` you can define any logic that you want
Again, you can return any serializable data structure from this function and that will be stored in the results database as a trackable metric for the execution of this handler.
Any errors you raise during this function will get captured by the client, and recorded as a failure to handle this `transfer` event log.

## Cron Tasks

You may also want to run some tasks according to a schedule, either for efficiency reasons or just that the task is not related to any chain-driven events.
You can do that with the `@cron` task decorator.

```python
@app.cron("* */1 * * *")
def every_hour():
...
```

For more information see [the linux handbook section on the crontab syntax](https://linuxhandbook.com/crontab/#understanding-crontab-syntax) or the [crontab.guru](https://crontab.guru/) generator.

## Startup and Shutdown

### Worker Events
Expand Down

0 comments on commit 7af65d8

Please sign in to comment.