1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

chore: Move logging on quit to runnable

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2023-04-05 10:38:06 -04:00
parent 1581da458d
commit 4ff3186ca7
2 changed files with 21 additions and 3 deletions

View File

@ -0,0 +1,21 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import loggerInjectable from "../../common/logger.injectable";
import { onQuitOfBackEndInjectionToken } from "../start-main-application/runnable-tokens/phases";
const logOnQuitOfBackendInjectable = getInjectable({
id: "log-on-quit-of-backend",
instantiate: (di) => ({
run: () => {
const logger = di.inject(loggerInjectable);
logger.info("Quitting application ...");
},
}),
injectionToken: onQuitOfBackEndInjectionToken,
});
export default logOnQuitOfBackendInjectable;

View File

@ -4,7 +4,6 @@
*/
import { getInjectable } from "@ogre-tools/injectable";
import forceAppExitInjectable from "./electron-app/features/force-app-exit.injectable";
import loggerInjectable from "../common/logger.injectable";
import emitAppEventInjectable from "../common/app-event-bus/emit-event.injectable";
const stopServicesAndExitAppInjectable = getInjectable({
@ -12,12 +11,10 @@ const stopServicesAndExitAppInjectable = getInjectable({
instantiate: (di) => {
const forceAppExit = di.inject(forceAppExitInjectable);
const logger = di.inject(loggerInjectable);
const emitAppEvent = di.inject(emitAppEventInjectable);
return async () => {
emitAppEvent({ name: "service", action: "close" });
logger.info("SERVICE:QUIT");
setTimeout(forceAppExit, 1000);
};
},