Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(@nestjs/scheduler): Add a warning when using non static providers
Adds a warning when trying to register cron jobs/timeouts/intervals using a non static provider.
- Loading branch information
jshayes
committed
Nov 15, 2021
1 parent
e15d1cc
commit 6b33111
Showing
8 changed files
with
253 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Injectable, Scope } from '@nestjs/common'; | ||
import { Cron } from '../../lib/decorators'; | ||
import { CronExpression } from '../../lib/enums'; | ||
|
||
@Injectable({ scope: Scope.REQUEST }) | ||
export class RequestScopedCronService { | ||
@Cron(CronExpression.EVERY_MINUTE) | ||
handleCron() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Injectable, Scope } from '@nestjs/common'; | ||
import { Interval } from '../../lib/decorators'; | ||
|
||
@Injectable({ scope: Scope.REQUEST }) | ||
export class RequestScopedIntervalService { | ||
@Interval('test', 2500) | ||
handleInterval() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Injectable, Scope } from '@nestjs/common'; | ||
import { Timeout } from '../../lib/decorators'; | ||
|
||
@Injectable({ scope: Scope.REQUEST }) | ||
export class RequestScopedTimeoutService { | ||
@Timeout('test', 2500) | ||
handleTimeout() {} | ||
} |