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

Structure for nested cron jobs #90

Open
scheung38 opened this issue Apr 14, 2016 · 2 comments
Open

Structure for nested cron jobs #90

scheung38 opened this issue Apr 14, 2016 · 2 comments

Comments

@scheung38
Copy link

I see similar question #65 asking for multiple cron jobs, but I would like to know how structure my app to have recurring top level parent cron job, which runs say every 15 mins and extracts time information from a service that returns an array of objects, and using these extracted time information to fire off an array of one time child cron jobs? Much appreciated Thanks

@scheung38
Copy link
Author

Can this one off cron job be rescheduled once submitted?

parser.recur().on(date).fullDate();

Say for example if we want to run once, but after submission, be able to be rescheduled again (as many times) before event actually happens so that in the end it is still one time job. If so an example would have thanks

@tomtom87
Copy link
Collaborator

I find it better to do this with reactive session variables so that the cron job can be conditional, this way you do not need to make a overly complicated solution.

For example:

# Booleans to track functionality
eventCompleted = false
processPage = true
processCompleted = false

# Inside cron
if eventCompleted
  # do code for if the event has finished

if processPage 
while !processCompleted 
 parsePage()

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

No branches or pull requests

2 participants