Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Reopen] Add API for checking the task is existing without throwing error #437

Merged
merged 2 commits into from Jan 22, 2021
Merged

[Reopen] Add API for checking the task is existing without throwing error #437

merged 2 commits into from Jan 22, 2021

Conversation

amokio
Copy link
Contributor

@amokio amokio commented Jan 14, 2021

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@@ -8,6 +8,19 @@ export class SchedulerRegistry {
private readonly timeouts = new Map<string, any>();
private readonly intervals = new Map<string, any>();

doesExists(type: 'cron' | 'timeout' | 'interval', name: string) {
switch (type) {
case 'cron':

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi :)
What about using enum for type? Maybe it will be easier to support it.
Cause if someone will add new type, or rename existing, it'll be additional work to change in all files instead of one string in enum?

Copy link
Contributor Author

@amokio amokio Jan 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here is unnecessary to use enum. Since the type of the task/job is already limited. There may only have interval, timeout, and cronjob.

Anyway, thanks for the code review. If the creator really want to use enum, I will update it and push it again

@kamilmysliwiec
Copy link
Member

LGTM thanks!

@kamilmysliwiec kamilmysliwiec merged commit d54c7ce into nestjs:master Jan 22, 2021
@amokio amokio deleted the @features/doesExist branch January 22, 2021 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants