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

feat: add logic to get jobs #23

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

Conversation

immanuel192
Copy link

@immanuel192 immanuel192 commented May 22, 2019

Changes

  • Add tryLock argument for all the job schedule function. This argument is available in Scheduler but not being use in Schedule service
  • Add getJobIds and getJobById. Just in case that we need to manually control the job.
  • Update the readme
  • For the cron job, safely use start time and end time
  • Allow pass arguments when invoke a job. This will be useful when you want to manually trigger a job

@immanuel192
Copy link
Author

@miaowing can u please help review this change. If possible I would like to have it asap for my project :) instead of using hacky way. thanks

@@ -24,25 +24,48 @@ export class Schedule {
cron: string,
callback: JobCallback,
config?: ICronJobConfig,
tryLock?: Promise<TryLock> | TryLock,
Copy link
Owner

@miaowing miaowing May 22, 2019

Choose a reason for hiding this comment

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

Thank your for your pull request.
Dynamic job is not support distribution now, because the job is not sync to other nodes in cluster, tryLock function in this has no effect. Maybe I will resolve it in the future.

Copy link
Author

Choose a reason for hiding this comment

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

I think it still ok for some cases. In my project, user can upload csv files. My app (which is running in multiple instances) will try to pick up the csv file to process data. In this case, I have to make sure that the mutex lock is good enough to not let other instances pick up the same file.

@meredian
Copy link

meredian commented Apr 8, 2021

@miaowing Hi! Found that PR. I was looking for similar thing - personally I'm interested in "show info when next run happens" and considered exposing job.nextInvocation() from node-schedule.

I see PR is a little bit stale. So maybe I could rework bits of this to make it happen. How'd you think?

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.

3 participants