Skip to content
Advertisement

Schedule tasks are called twice with the @SnapLock annotation

I want only one schedule method to work for many instances. I added the snap-scheduler to my project, and after that I deployed two different instances to the railway. And two entries about the execution of my method are added to the snap_lock table. Сan you explain where I went wrong?

It`s scheduler config:

JavaScript

It`s method with @SnapLock and @Scheduled annotations

JavaScript

It`s psql

JavaScript

Advertisement

Answer

As an alternative, I solved my problem using a library https://github.com/lukas-krecan/ShedLock. Everything is similar there, the method through the base is blocked. But there were no problems with crowns.

Advertisement