-
Notifications
You must be signed in to change notification settings - Fork 35
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
base: master
Are you sure you want to change the base?
Conversation
@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, |
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.
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.
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.
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.
@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 I see PR is a little bit stale. So maybe I could rework bits of this to make it happen. How'd you think? |
Changes
tryLock
argument for all the job schedule function. This argument is available inScheduler
but not being use inSchedule
servicegetJobIds
andgetJobById
. Just in case that we need to manually control the job.