修复hook订阅移除失败的问题

This commit is contained in:
648540858 2023-05-08 17:55:07 +08:00
parent f124aebb30
commit e344445ed9

View File

@ -98,7 +98,10 @@ public class ZlmHttpHookSubscribe {
if (!CollectionUtils.isEmpty(entriesToRemove)) { if (!CollectionUtils.isEmpty(entriesToRemove)) {
for (Map.Entry<IHookSubscribe, ZlmHttpHookSubscribe.Event> entry : entriesToRemove) { for (Map.Entry<IHookSubscribe, ZlmHttpHookSubscribe.Event> entry : entriesToRemove) {
entries.remove(entry); eventMap.remove(entry.getKey());
}
if (eventMap.size() == 0) {
allSubscribes.remove(hookSubscribe.getHookType());
} }
} }
@ -137,7 +140,6 @@ public class ZlmHttpHookSubscribe {
// @Scheduled(cron="0 0/5 * * * ?") //每5分钟执行一次 // @Scheduled(cron="0 0/5 * * * ?") //每5分钟执行一次
@Scheduled(fixedRate = 2 * 1000) @Scheduled(fixedRate = 2 * 1000)
public void execute(){ public void execute(){
System.out.println(allSubscribes.size());
Instant instant = Instant.now().minusMillis(TimeUnit.MINUTES.toMillis(5)); Instant instant = Instant.now().minusMillis(TimeUnit.MINUTES.toMillis(5));
int total = 0; int total = 0;
for (HookType hookType : allSubscribes.keySet()) { for (HookType hookType : allSubscribes.keySet()) {