add a shutdown method to buffer service
This commit is contained in:
1 parent
2b9ff52f6b
commit
8579edd56e
1 file changed
+10
@@ -13,6 +13,7 @@ export interface IBufferService {
|
|||||||
scheduleNextFlush(): void;
|
scheduleNextFlush(): void;
|
||||||
flushBuffer(): Promise<void>;
|
flushBuffer(): Promise<void>;
|
||||||
flushGeoBuffer(): Promise<void>;
|
flushGeoBuffer(): Promise<void>;
|
||||||
|
shutdown(): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BufferService implements IBufferService {
|
export class BufferService implements IBufferService {
|
||||||
@@ -152,4 +153,13 @@ export class BufferService implements IBufferService {
|
|||||||
this.geoBuffer = [];
|
this.geoBuffer = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async shutdown() {
|
||||||
|
if (this.bufferTimer) {
|
||||||
|
clearTimeout(this.bufferTimer);
|
||||||
|
this.bufferTimer = null;
|
||||||
|
}
|
||||||
|
await this.flushBuffer();
|
||||||
|
await this.flushGeoBuffer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user