Skip to content

Commit

Permalink
docs(nestjs): Inline cron decorator config #11682
Browse files Browse the repository at this point in the history
  • Loading branch information
chargome authored Oct 30, 2024
1 parent 8beed78 commit 3b292c8
Showing 1 changed file with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,19 @@ To get started, import `SentryCron` from `@sentry/nestjs` and use it to decorate

```typescript
import { Cron } from '@nestjs/schedule';
import { SentryCron, MonitorConfig } from '@sentry/nestjs';
import type { MonitorConfig } from '@sentry/types';

const monitorConfig: MonitorConfig = {
schedule: {
type: "crontab",
value: "* * * * *",
},
checkinMargin: 2, // In minutes. Optional.
maxRuntime: 10, // In minutes. Optional.
timezone: "America/Los_Angeles", // Optional.
};
import { SentryCron } from '@sentry/nestjs';

export class MyCronService {
@Cron('* * * * *')
@SentryCron('my-monitor-slug', monitorConfig)
@SentryCron('my-monitor-slug', {
schedule: {
type: "crontab",
value: "* * * * *",
},
checkinMargin: 2, // In minutes. Optional.
maxRuntime: 10, // In minutes. Optional.
timezone: "America/Los_Angeles", // Optional.
})
handleCron() {
// Your cron job logic here
}
Expand Down

0 comments on commit 3b292c8

Please sign in to comment.