-
Notifications
You must be signed in to change notification settings - Fork 634
Open
Description
Description
`async function waitForJobCompletion(waitTime = CRON_JOB_WAIT_TIME, maxRetries = CRON_JOB_CHECK_MAX_RETRIES) {
const isJobRunning = job.isCallbackRunning;
const isRetriesExhausted = maxRetries == 0;
if (!isJobRunning || isRetriesExhausted) return;
INFO('Waiting for the running callback');
await wait(waitTime);
await waitForJobCompletion(waitTime, maxRetries - 1);
}
`
If we check whether the job is running outside the cron job onTick callback it always returns false even if the callback is running currently
Expected Behavior
isCallbackRunning
property should return true if the callback is running for the given cron
Actual Behavior
isCallbackRunning
property always returns false
Possible Fix
Internally set the isCallbackrunning to correct value so that when we check the property outside it shows correct value.
Steps to Reproduce
- Set a cron that runs every minute
- When the callback for the cron is running, externally check the isCallbackrunning property, view a different callback (Inside setInterval etc)
Context
I was trying to gracefully close the cron job
Your Environment
cron
version:- NodeJS version:
- Operating System and version:
- TypeScript version (if applicable):
- Link to your project (if applicable):
Metadata
Metadata
Assignees
Labels
No labels