I am currently working on the Automatic Git Cache Maintenance Project under GSoC 2022. The aim of the project is to integrate git maintenance command to Jenkins to optimize the caches present on the Jenkins Controller.
Administrators can schedule various maintenance tasks by
entering CronSytax in the UI. The data entered is stored
internally in an XML file. I am confused between
PeriodicWork/AsyncPeriodicWork to schedule the maintenance
tasks.
The way I am thinking to implement is to extend this class and
check every minute whether any of the maintenance task satisfy
the cronSyntax entered by the administrator. If the current time
satisfies the cronSyntax of a particulat task, then that task is
added to a queue.
I am planning to create another thread which consumes the maintenance tasks present in the queue. The reason for creating another thread is to not block the thread which validates and pushes the maintenance task into the queue. The javadoc of PeriodicWork suggests to use it if the work done is short. I am more inclined towards using PeriodicWork. However, I am not sure about the performance.
I am not sure if this is the best approach and looking for help from the community. Open to suggestions and discussion.
Thank You
Hrushikesh Rao