提交 e23da381 作者: 洪东保

定时器里面都要异步执行

父级 99424384
package com.cmeeting.job;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.thread.ThreadUtil;
import com.azure.core.credential.AccessToken;
import com.azure.core.credential.TokenRequestContext;
import com.azure.identity.ClientSecretCredential;
......@@ -83,6 +84,7 @@ public class CmeetingJob {
*/
@Scheduled(cron = "0 30 6 * * ?")
public void weComUserSync() {
ThreadUtil.execute(()-> {
if (!redisUtils.setnx("weComUserSync", "weComUserSync", 20 * 60 * 60)) {
return;
}
......@@ -98,6 +100,7 @@ public class CmeetingJob {
} finally {
redisUtils.del("weComUserSync");
}
});
}
/**
......@@ -106,6 +109,7 @@ public class CmeetingJob {
@Scheduled(cron = "0 0 7 * * ?")
// @Scheduled(fixedRate = 5 * 60 * 1000)
public void TencentUserSync() {
ThreadUtil.execute(()-> {
if (!redisUtils.setnx("TencentUserSync", "TencentUserSync", 20 * 60 * 60)) {
return;
}
......@@ -120,6 +124,7 @@ public class CmeetingJob {
} finally {
redisUtils.del("TencentUserSync");
}
});
}
/**
......@@ -127,6 +132,7 @@ public class CmeetingJob {
*/
@Scheduled(cron = "0 20 7 * * ?")
public void userBind() {
ThreadUtil.execute(()-> {
if (!redisUtils.setnx("userBind", "userBind", 20 * 60 * 60)) {
return;
}
......@@ -140,10 +146,12 @@ public class CmeetingJob {
} finally {
redisUtils.del("userBind");
}
});
}
@Scheduled(fixedRate = 20 * 60 * 1000, initialDelay = 1 * 60 * 1000)
public void execute() {
ThreadUtil.execute(()-> {
if (isDev) {
return;
}
......@@ -182,6 +190,7 @@ public class CmeetingJob {
} finally {
redisUtils.del("Scheduled-All");
}
});
}
......@@ -190,6 +199,7 @@ public class CmeetingJob {
*/
@Scheduled(fixedRate = 30 * 60 * 1000, initialDelay = 3 * 60 * 1000)
public void meetingMinutesRetry() {
ThreadUtil.execute(()-> {
if (isDev) {
return;
}
......@@ -241,6 +251,7 @@ public class CmeetingJob {
} finally {
redisUtils.del("Scheduled-retry");
}
});
}
/**
......@@ -248,6 +259,7 @@ public class CmeetingJob {
*/
@Scheduled(fixedRate = 10 * 60 * 1000, initialDelay = 1 * 60 * 1000)
public void emailPushRetry() {
ThreadUtil.execute(()-> {
if (isDev) {
return;
}
......@@ -294,6 +306,7 @@ public class CmeetingJob {
} finally {
redisUtils.del("Scheduled-email-retry");
}
});
}
@Resource
......@@ -308,6 +321,7 @@ public class CmeetingJob {
@Scheduled(cron = "50 59 7,9,11,13,15,17,19,21,23 * * ?")
public void emailStatisticsPush() {
ThreadUtil.execute(()->{
if (isDev) {
return;
}
......@@ -357,9 +371,10 @@ public class CmeetingJob {
throw new RuntimeException(e);
} finally {
file.delete();
// redisUtils.del("emailStatisticsPush");
redisUtils.del("emailStatisticsPush");
}
log.info("推送统计邮件完成!");
});
}
// @Scheduled(cron = "0 0 * * * ?")
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论