-
Notifications
You must be signed in to change notification settings - Fork 86
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
ScheduledTask with multiple backends running #255
Comments
Yes this is true. So far we just ignored this because it does not have any sideeffects it multiple services are cleaning the database. Of course, this is not optimal. Another simple solution would be, to just have an additional profile or application property that enables the master service. But ShedLock looks also quite nice and simple to integrate. |
I created the PR #262 to solve this issue. IMHO you should clean the data only once per day so instead of having: @Scheduled(fixedRate = 60 * 60 * 1000L, initialDelay = 60 * 1000L) you could have: @Scheduled(cron = "0 0 0 0 * *") |
I think there is a Also, it's often good practice to chose a 'random' number to avoid different services starting at the same time. So
Might be better to run it at 12:42:30 am every day. |
Thanks @ineiti , you're right. |
In https://github.com/DP-3T/dp3t-sdk-backend/blob/develop/dpppt-backend-sdk/dpppt-backend-sdk-ws/src/main/java/org/dpppt/backend/sdk/ws/config/WSBaseConfig.java you have a method "configureTasks" that runs periodically to clean the database.
If you have more than one backends running (as expected in an HA environment), you are launching this method for each backend, aren't you?
The optimal solution would be to use Quartz or ShedLock to secure launching the database cleaning.
The text was updated successfully, but these errors were encountered: