Commit affbd89fdb7a1a0dbfea2d5ff871c1e4989aaff9

Authored by 648540858
1 parent c429a34e

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

src/main/java/com/genersoft/iot/vmp/media/zlm/ZlmHttpHookSubscribe.java
@@ -98,7 +98,10 @@ public class ZlmHttpHookSubscribe { @@ -98,7 +98,10 @@ public class ZlmHttpHookSubscribe {
98 98
99 if (!CollectionUtils.isEmpty(entriesToRemove)) { 99 if (!CollectionUtils.isEmpty(entriesToRemove)) {
100 for (Map.Entry<IHookSubscribe, ZlmHttpHookSubscribe.Event> entry : entriesToRemove) { 100 for (Map.Entry<IHookSubscribe, ZlmHttpHookSubscribe.Event> entry : entriesToRemove) {
101 - entries.remove(entry); 101 + eventMap.remove(entry.getKey());
  102 + }
  103 + if (eventMap.size() == 0) {
  104 + allSubscribes.remove(hookSubscribe.getHookType());
102 } 105 }
103 } 106 }
104 107
@@ -137,7 +140,6 @@ public class ZlmHttpHookSubscribe { @@ -137,7 +140,6 @@ public class ZlmHttpHookSubscribe {
137 // @Scheduled(cron="0 0/5 * * * ?") //每5分钟执行一次 140 // @Scheduled(cron="0 0/5 * * * ?") //每5分钟执行一次
138 @Scheduled(fixedRate = 2 * 1000) 141 @Scheduled(fixedRate = 2 * 1000)
139 public void execute(){ 142 public void execute(){
140 - System.out.println(allSubscribes.size());  
141 Instant instant = Instant.now().minusMillis(TimeUnit.MINUTES.toMillis(5)); 143 Instant instant = Instant.now().minusMillis(TimeUnit.MINUTES.toMillis(5));
142 int total = 0; 144 int total = 0;
143 for (HookType hookType : allSubscribes.keySet()) { 145 for (HookType hookType : allSubscribes.keySet()) {