-
-
Notifications
You must be signed in to change notification settings - Fork 666
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
chore: type improvement for schedulers #6136
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,7 @@ export const scheduleServices = async ( | |
apiTokenService.fetchActiveTokens.bind(apiTokenService), | ||
minutesToMilliseconds(1), | ||
'fetchActiveTokens', | ||
0, // no jitter -> run immediately | ||
); | ||
|
||
schedulerService.schedule( | ||
|
@@ -131,16 +132,16 @@ export const scheduleServices = async ( | |
); | ||
|
||
schedulerService.schedule( | ||
() => { | ||
clientMetricsServiceV2.bulkAdd().catch(console.error); | ||
async () => { | ||
await clientMetricsServiceV2.bulkAdd().catch(console.error); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but there's no return... I could add one, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In general it's more idiomatic to do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. () => Promise.resolve() returns the promise when you don't add {} around it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
}, | ||
secondsToMilliseconds(5), | ||
'bulkAddMetrics', | ||
); | ||
|
||
schedulerService.schedule( | ||
() => { | ||
clientMetricsServiceV2.clearMetrics(48).catch(console.error); | ||
async () => { | ||
await clientMetricsServiceV2.clearMetrics(48).catch(console.error); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
}, | ||
hoursToMilliseconds(12), | ||
'clearMetrics', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Getting worse: Large Method
scheduleServices increases from 135 to 136 lines of code, threshold = 70
Why does this problem occur?
Large functions with many lines of code are generally harder to understand and lower the code health. Avoid adding more lines to this function. Read more.
To ignore this warning click here.