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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

getStatus() method and destroy() methods updated #296

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

harindra-dev
Copy link

@harindra-dev harindra-dev commented Aug 4, 2021

Hello Patron 馃槈,

Super excited to share,
I just made a few changes to make the scheduler methods getStatus() and destroy() methods work fine.

  • - getStatus() method will return a boolean | null after this change. 馃憤
  • - destroy() method will return a promise to handle destroy. 馃憤

Code modifications as follows:

scheduler.js

destroy() {
    return new Promise((res, rej) => {
        this.stop();
        setTimeout(() => {
            if(!this.getStatus()) return res(true);
            return rej(false);
        }, 15);
    })
}

getStatus() {
    return this.timeout && !this.timeout._destroyed;
}

scheduled-task.js

 this.destroy = () => {
      return scheduler.destroy();
  }

  this.getStatus = () => {
      return scheduler.getStatus();
  }

Hope these modifications will be helpful 馃.

Thanking you
harindradev94

harindra-dev and others added 10 commits August 4, 2021 22:11
getStatus() method will return true if the cron job is in running.
destroy() method will return a promise to ensure whether the crone job is stopped or not.
getStatus() method will return true if the cron job is in running.
destroy() method will return a promise to ensure whether the crone job is stopped or not.
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

2 participants