feat: add buffer lookup and location results update to services
## Changes - Add findInBuffer() to BufferService for looking up checks still in the write buffer - Add updateLocationResults() to IChecksRepository interface and MongoChecksRepository - Update GlobalpingService to return GlobalpingCheckResult[] instead of MonitorStatusResponse[] ## Benefits Non-destructive service additions that prepare the backfill pipeline. Existing check-writing and Globalping flows are unchanged.
This commit is contained in:
1 parent
d25ce9e498
commit
3b858de2b5
4 files changed
+20
-14
No files matched your search
@@ -5,6 +5,7 @@ const SERVICE_NAME = "BufferService";
|
||||
export interface IBufferService {
|
||||
addToBuffer(check: Check): void;
|
||||
removeCheckFromBuffer(check: Check): boolean;
|
||||
findInBuffer(checkId: string): Check | undefined;
|
||||
scheduleNextFlush(): void;
|
||||
flushBuffer(): Promise<void>;
|
||||
}
|
||||
@@ -49,6 +50,10 @@ class BufferService implements IBufferService {
|
||||
}
|
||||
}
|
||||
|
||||
findInBuffer(checkId: string): Check | undefined {
|
||||
return this.buffer.find((c: Check) => c.id?.toString() === checkId);
|
||||
}
|
||||
|
||||
removeCheckFromBuffer(checkToRemove: Check) {
|
||||
try {
|
||||
if (!checkToRemove) {
|
||||
|
||||
Reference in new issue
Block a user