Check out the source code on github
lcm = least common multiple of all Sync Frequencies from all the tasks
interval = 1/total_jobs
(total_jobs = sum of all sync frequencies from all the tasks)
The old scheduler, schedules each job at a different time throuout the day based on the total number of jobs.
Example Tasks and Syncs per day:
lcm = 12
Total Syncs = 24
This is not Ideal as some tasks can have a large amount of variation in the interval between when they get synced.
For Example the green task has a minimum of 1 hour between syncs and a maximum of 5 hours between syncs
This problem is even worse with the actual task set for production as some tasks might sync twice in 18 minutes and then not sync again for hours
interval = 1/lcm
Each job now has a list of tasks that run at the same time
Using the same example as before I get the following schedule, labeled with X's.
I have included the old schedule below for comparison, labeled with circles
This is much better because each task is evenly spread throuout the day
At lcm interval 0 all tasks want to run and if we run every task in parallel at the same time that could cause problems
We could create a queue and run all tasks in succession
if there is a really long task or a lot of tasks it could take a long time to get through them all and the queue could get backed up
This creates inconsistant intervals for each task again
We have a set number of threads that all access the same queue
this solves the pure parallel issue: Because Its a set number we have a cap to the number of tasks running at the same time
this solves the queue conjestion issue: We avoid congestion because any really long task will only conjest one of the threads
The Sync Scheduler can manually sync tasks in a detached thread
Curriently this works by listening std::cin
Eventually we will want to attach this to dispach or something else?
The Sync Scheduler logs when it syncs tasks and any errors, to the log server that Juno made, using the logging class that Cary made