From e9a48e5303e0b2ff69f41fbf7932de896eb85aa8 Mon Sep 17 00:00:00 2001
From: tnt group <dodu@live.cn>
Date: 星期日, 30 七月 2023 13:25:38 +0800
Subject: [PATCH] fix: 修复请求截图api生成文件名称的异常
---
src/main/java/com/genersoft/iot/vmp/media/zlm/ZlmHttpHookSubscribe.java | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 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 823bdab..cad119a 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
@@ -1,9 +1,10 @@
package com.genersoft.iot.vmp.media.zlm;
-import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.media.zlm.dto.HookType;
import com.genersoft.iot.vmp.media.zlm.dto.IHookSubscribe;
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
+import com.genersoft.iot.vmp.media.zlm.dto.hook.HookParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
@@ -26,7 +27,7 @@
@FunctionalInterface
public interface Event{
- void response(MediaServerItem mediaServerItem, JSONObject response);
+ void response(MediaServerItem mediaServerItem, HookParam hookParam);
}
private Map<HookType, Map<IHookSubscribe, ZlmHttpHookSubscribe.Event>> allSubscribes = new ConcurrentHashMap<>();
@@ -98,7 +99,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());
}
}
@@ -134,11 +138,9 @@
/**
* 瀵硅闃呮暟鎹繘琛岃繃鏈熸竻鐞�
*/
- @Scheduled(cron="0 0/5 * * * ?") //姣�5鍒嗛挓鎵ц涓�娆�
+// @Scheduled(cron="0 0/5 * * * ?") //姣�5鍒嗛挓鎵ц涓�娆�
+ @Scheduled(fixedRate = 2 * 1000)
public void execute(){
-
- logger.info("[hook璁㈤槄] 娓呯悊");
-
Instant instant = Instant.now().minusMillis(TimeUnit.MINUTES.toMillis(5));
int total = 0;
for (HookType hookType : allSubscribes.keySet()) {
@@ -153,6 +155,5 @@
}
}
}
- logger.info("[hook璁㈤槄] 娓呯悊缁撴潫锛屽叡娓呯悊{}鏉¤繃鏈熸暟鎹�", total);
}
}
--
Gitblit v1.8.0