Skip to content

Commit

Permalink
Merge pull request #71 from LolzTheDev/patch-2
Browse files Browse the repository at this point in the history
make tasks docs more user friendly
  • Loading branch information
jacoobes committed Jul 20, 2024
2 parents 2bfe4bc + b016cf1 commit aaff2a0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/content/docs/v4/reference/tasks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Your app may need to execute tasks in the future on intervals or over a long tim
export const tasks = "./dist/tasks"
```

Defines a task that runs every minute.
The snippet below defines a task that runs every minute. Keep in mind that the file name is just a unique identifier and you can name it however you want.
```js title="./src/tasks/every-minute.js"
import { scheduledTask } from "@sern/handler";

Expand All @@ -23,3 +23,10 @@ export default scheduledTask({
}
})
```

The `trigger` is a cron tab pattern, you can edit and test one [here](https://crontab.guru/).

:::tip
If you want to cancel a task in the future, you'll need to know it's name!
`deps['@sern/scheduler'].kill(uuid)` will kill the task.
:::

0 comments on commit aaff2a0

Please sign in to comment.