| | |
| | | hookSubscribe.setExpires(expiresInstant); |
| | | } |
| | | allSubscribes.computeIfAbsent(hookSubscribe.getHookType(), k -> new ConcurrentHashMap<>()).put(hookSubscribe, event); |
| | | System.out.println(allSubscribes); |
| | | } |
| | | |
| | | public ZlmHttpHookSubscribe.Event sendNotify(HookType type, JSONObject hookResponse) { |
| | |
| | | } |
| | | for (IHookSubscribe key : eventMap.keySet()) { |
| | | Boolean result = null; |
| | | |
| | | for (String s : key.getContent().keySet()) { |
| | | if (result == null) { |
| | | result = key.getContent().getString(s).equals(hookResponse.getString(s)); |
| | |
| | | |
| | | 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()); |
| | | } |
| | | } |
| | | |
| | |
| | | // @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()) { |