提交 e23da381 作者: 洪东保

定时器里面都要异步执行

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