From e1aa5b215840f3e5133d095de5458dc4f151583a Mon Sep 17 00:00:00 2001 From: fufuu Date: Thu, 10 Oct 2024 17:04:29 +0200 Subject: [PATCH] cache save session --- .../org/usf/inspect/server/controller/CacheController.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/usf/inspect/server/controller/CacheController.java b/src/main/java/org/usf/inspect/server/controller/CacheController.java index bec64db..cf77edb 100644 --- a/src/main/java/org/usf/inspect/server/controller/CacheController.java +++ b/src/main/java/org/usf/inspect/server/controller/CacheController.java @@ -16,6 +16,7 @@ import org.usf.inspect.core.DispatchState; import org.usf.inspect.server.dao.RequestDao; import org.usf.inspect.server.model.ServerSession; +import org.usf.inspect.server.service.RequestService; import org.usf.inspect.server.service.SessionQueueService; import lombok.RequiredArgsConstructor; @@ -27,7 +28,7 @@ public class CacheController { private final ObjectMapper mapper; - private final RequestDao dao; + private final RequestService service; private final SessionQueueService queue; RestTemplate defaultRestTemplate() { @@ -53,7 +54,7 @@ public int addSession(@RequestParam(name = "host") String host) { var rt = defaultRestTemplate(); var ses = rt.getForObject(host + "/cache", ServerSession[].class); if(ses != null && ses.length > 0) { - dao.saveSessions(Arrays.asList(ses)); + service.addSessions(Arrays.asList(ses)); return ses.length; } return 0;