refactor: enhance session cleanup task with error handling and logging
This commit is contained in:
parent
9e562fbc1a
commit
c1976052b2
@ -5,9 +5,11 @@ import com.magamochi.ingestion.service.FlareSessionRegistry;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Log4j2
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class FlareSessionCleanupTask {
|
||||
@ -26,8 +28,14 @@ public class FlareSessionCleanupTask {
|
||||
return;
|
||||
}
|
||||
|
||||
client.destroySession(
|
||||
FlareClient.SessionDestroyRequest.builder().session(session.sessionId()).build());
|
||||
try {
|
||||
client.destroySession(
|
||||
FlareClient.SessionDestroyRequest.builder()
|
||||
.session(session.sessionId())
|
||||
.build());
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to destroy session for provider {}: {}", provider, e.getMessage());
|
||||
}
|
||||
|
||||
registry.remove(provider);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user