I'm using Shedlock version 4.22.0 with JDBC intergation. I have one configuration class
@Configuration
@EnableScheduling
@EnableSchedulerLock(defaultLockAtMostFor = "PT30S")public class ShedLockConfiguration {
public class ShedLockConfiguration {
@Bean
public LockProvider lockProvider(DataSource dataSource) {
return new JdbcTemplateLockProvider(dataSource);
}
}
For execution I'm using annotation @SchedulerLock eg.
@SchedulerLock(name = "MyTask", lockAtMostFor = "PT1M", lockAtLeastFor = "PT1M")
Everything works perfectly on a local PC but when app is deployed on Kubernetes (AKS), no task are triggered. Logs are empty. App after startup does nothing
I added also debug to spring configuration on
logging:
level:
net.javacrumbs.shedlock: DEBUG
Nothing is logged
I solved issue. The problem was with timezone on server. Task was locked 1h ahead because of diffrent timezone on my local PC. I removed all rows from shedlock table
Execution should be triggered by a @Scheduled
annotation. ShedLock only prevents parallel task execution, it does not schedule anything. If you have the @Scheduled
annotation, check the shedlock
table in the DB as described in troubleshooting.