简体   繁体   English

ShedLock - 不在 Kubernetes 上执行

[英]ShedLock - Not Executing on Kubernetes

I'm using Shedlock version 4.22.0 with JDBC intergation.我正在使用带有 JDBC 集成的 Shedlock 版本 4.22.0。 I have one configuration class我有一个配置 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 例如。

@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.一切都在本地 PC 上完美运行,但是当应用程序部署在 Kubernetes (AKS) 上时,不会触发任何任务。 Logs are empty.日志是空的。 App after startup does nothing启动后的应用程序什么也不做

I added also debug to spring configuration on我还添加了对 spring 配置的调试

logging:
  level:
    net.javacrumbs.shedlock: DEBUG

Nothing is logged没有记录任何内容

Execution should be triggered by a @Scheduled annotation .执行应该由@Scheduled注解触发。 ShedLock only prevents parallel task execution, it does not schedule anything. ShedLock 只阻止并行任务执行,它不安排任何事情。 If you have the @Scheduled annotation, check the shedlock table in the DB as described in troubleshooting .如果您有@Scheduled注释,请按照疑难解答中的说明检查数据库中的shedlock表。

I solved issue.我解决了问题。 The problem was with timezone on server.问题出在服务器上的时区。 Task was locked 1h ahead because of diffrent timezone on my local PC.由于我本地 PC 上的时区不同,任务提前 1 小时锁定。 I removed all rows from shedlock table我从 shedlock 表中删除了所有行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM