mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-21 15:09:10 +00:00
refactor: debounce writing to disk
This commit is contained in:
committed by
Carlos Valente
parent
e16ec3f388
commit
77779a4648
@@ -25,7 +25,7 @@ import { integrationRouter } from './api-integration/integration.router.js';
|
||||
|
||||
// Import adapters
|
||||
import { socket } from './adapters/WebsocketAdapter.js';
|
||||
import { getDataProvider } from './classes/data-provider/DataProvider.js';
|
||||
import { getDataProvider, flushPendingWrites } from './classes/data-provider/DataProvider.js';
|
||||
|
||||
// Services
|
||||
import { logger } from './classes/Logger.js';
|
||||
@@ -266,6 +266,10 @@ export const startIntegrations = async () => {
|
||||
export const shutdown = async (exitCode = 0) => {
|
||||
consoleHighlight(`Ontime shutting down with code ${exitCode}`);
|
||||
|
||||
await flushPendingWrites().catch((_error) => {
|
||||
/** nothing do to here */
|
||||
});
|
||||
|
||||
// clear the restore file if it was a normal exit
|
||||
// 0 means it was a SIGNAL
|
||||
// 1 means crash -> keep the file
|
||||
|
||||
Reference in New Issue
Block a user