From affbd89fdb7a1a0dbfea2d5ff871c1e4989aaff9 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期一, 08 五月 2023 17:55:07 +0800
Subject: [PATCH] 修复hook订阅移除失败的问题

---
 src/main/java/com/genersoft/iot/vmp/media/zlm/ZlmHttpHookSubscribe.java |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZlmHttpHookSubscribe.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZlmHttpHookSubscribe.java
index 4d0069b..8f6a3fa 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZlmHttpHookSubscribe.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZlmHttpHookSubscribe.java
@@ -98,7 +98,10 @@
 
             if (!CollectionUtils.isEmpty(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 @@
 //    @Scheduled(cron="0 0/5 * * * ?")   //姣�5鍒嗛挓鎵ц涓�娆�
     @Scheduled(fixedRate = 2 * 1000)
     public void execute(){
-        System.out.println(allSubscribes.size());
         Instant instant = Instant.now().minusMillis(TimeUnit.MINUTES.toMillis(5));
         int total = 0;
         for (HookType hookType : allSubscribes.keySet()) {

--
Gitblit v1.8.0