From 1a9485ab60b90c86797d729fc161c55676f1884c Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 2 Nov 2022 16:11:32 -0400 Subject: [PATCH] Use getSyncStartableStoppable in as many places as possible - Used to fix danging promises during quit Signed-off-by: Sebastian Malton --- .../listening-on-message-channels.injectable.ts | 4 ++-- .../main/application-menu-reactivity.injectable.ts | 4 ++-- .../main/start-application-menu.injectable.ts | 4 ++-- .../main/stop-application-menu.injectable.ts | 4 ++-- .../main/periodical-check-for-updates.injectable.ts | 5 ++--- .../main/start-checking-for-updates.injectable.ts | 4 ++-- .../main/stop-checking-for-updates.injectable.ts | 4 ++-- ...watch-if-update-should-happen-on-quit.injectable.ts | 4 ++-- .../catalog-sync-to-renderer.injectable.ts | 4 ++-- .../start-catalog-sync.injectable.ts | 4 ++-- .../stop-catalog-sync.injectable.ts | 4 ++-- .../sync-theme-from-operating-system.injectable.ts | 8 +++----- ...nnables-before-closing-of-application.injectable.ts | 10 ++-------- .../broadcast-theme-change.injectable.ts | 4 ++-- .../start-broadcasting-theme-change.injectable.ts | 4 ++-- .../stop-broadcasting-theme-change.injectable.ts | 4 ++-- ...t-syncing-theme-from-operating-system.injectable.ts | 4 ++-- ...p-syncing-theme-from-operating-system.injectable.ts | 4 ++-- src/main/tray/menu-icon/reactive.injectable.ts | 4 ++-- src/main/tray/menu-icon/start-reactivity.injectable.ts | 4 ++-- src/main/tray/menu-icon/stop-reactivity.injectable.ts | 4 ++-- .../reactive-tray-menu-items.injectable.ts | 4 ++-- .../start-reactive-tray-menu-items.injectable.ts | 4 ++-- .../stop-reactive-tray-menu-items.injectable.ts | 4 ++-- .../listening-on-request-channels.injectable.ts | 4 ++-- .../start-listening-on-channels.injectable.ts | 6 +++--- 26 files changed, 54 insertions(+), 63 deletions(-) diff --git a/src/common/utils/channel/listening-on-message-channels.injectable.ts b/src/common/utils/channel/listening-on-message-channels.injectable.ts index afe0c08f24..e3c9eafd6f 100644 --- a/src/common/utils/channel/listening-on-message-channels.injectable.ts +++ b/src/common/utils/channel/listening-on-message-channels.injectable.ts @@ -3,7 +3,7 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectable } from "@ogre-tools/injectable"; -import { getStartableStoppable } from "../get-startable-stoppable"; +import { getSyncStartableStoppable } from "../get-startable-stoppable"; import { disposer } from "../index"; import { messageChannelListenerInjectionToken } from "./message-channel-listener-injection-token"; import { enlistMessageChannelListenerInjectionToken } from "./enlist-message-channel-listener-injection-token"; @@ -15,7 +15,7 @@ const listeningOnMessageChannelsInjectable = getInjectable({ const enlistMessageChannelListener = di.inject(enlistMessageChannelListenerInjectionToken); const messageChannelListeners = di.injectMany(messageChannelListenerInjectionToken); - return getStartableStoppable("listening-on-channels", () => ( + return getSyncStartableStoppable("listening-on-channels", () => ( disposer(messageChannelListeners.map(enlistMessageChannelListener)) )); }, diff --git a/src/features/application-menu/main/application-menu-reactivity.injectable.ts b/src/features/application-menu/main/application-menu-reactivity.injectable.ts index 67631322aa..643af43d12 100644 --- a/src/features/application-menu/main/application-menu-reactivity.injectable.ts +++ b/src/features/application-menu/main/application-menu-reactivity.injectable.ts @@ -4,7 +4,7 @@ */ import { getInjectable } from "@ogre-tools/injectable"; import { autorun } from "mobx"; -import { getStartableStoppable } from "../../../common/utils/get-startable-stoppable"; +import { getSyncStartableStoppable } from "../../../common/utils/get-startable-stoppable"; import populateApplicationMenuInjectable from "./populate-application-menu.injectable"; import applicationMenuItemCompositeInjectable from "./application-menu-item-composite.injectable"; @@ -15,7 +15,7 @@ const applicationMenuReactivityInjectable = getInjectable({ const applicationMenuItemComposite = di.inject(applicationMenuItemCompositeInjectable); const populateApplicationMenu = di.inject(populateApplicationMenuInjectable); - return getStartableStoppable("application-menu-reactivity", () => + return getSyncStartableStoppable("application-menu-reactivity", () => autorun(() => populateApplicationMenu(applicationMenuItemComposite.get()), { delay: 100, }), diff --git a/src/features/application-menu/main/start-application-menu.injectable.ts b/src/features/application-menu/main/start-application-menu.injectable.ts index 77fb31cb2a..a3edd09ca1 100644 --- a/src/features/application-menu/main/start-application-menu.injectable.ts +++ b/src/features/application-menu/main/start-application-menu.injectable.ts @@ -16,8 +16,8 @@ const startApplicationMenuInjectable = getInjectable({ return { id: "start-application-menu", - run: async () => { - await applicationMenu.start(); + run: () => { + applicationMenu.start(); }, }; }, diff --git a/src/features/application-menu/main/stop-application-menu.injectable.ts b/src/features/application-menu/main/stop-application-menu.injectable.ts index 63abccadf9..ad079bab34 100644 --- a/src/features/application-menu/main/stop-application-menu.injectable.ts +++ b/src/features/application-menu/main/stop-application-menu.injectable.ts @@ -16,8 +16,8 @@ const stopApplicationMenuInjectable = getInjectable({ return { id: "stop-application-menu", - run: async () => { - await applicationMenu.stop(); + run: () => { + applicationMenu.stop(); }, }; }, diff --git a/src/features/application-update/child-features/periodical-checking-of-updates/main/periodical-check-for-updates.injectable.ts b/src/features/application-update/child-features/periodical-checking-of-updates/main/periodical-check-for-updates.injectable.ts index 472cf31a06..5fa3482319 100644 --- a/src/features/application-update/child-features/periodical-checking-of-updates/main/periodical-check-for-updates.injectable.ts +++ b/src/features/application-update/child-features/periodical-checking-of-updates/main/periodical-check-for-updates.injectable.ts @@ -3,7 +3,7 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectable } from "@ogre-tools/injectable"; -import { getStartableStoppable } from "../../../../../common/utils/get-startable-stoppable"; +import { getSyncStartableStoppable } from "../../../../../common/utils/get-startable-stoppable"; import processCheckingForUpdatesInjectable from "../../../main/process-checking-for-updates.injectable"; import withOrphanPromiseInjectable from "../../../../../common/utils/with-orphan-promise/with-orphan-promise.injectable"; @@ -14,13 +14,12 @@ const periodicalCheckForUpdatesInjectable = getInjectable({ const withOrphanPromise = di.inject(withOrphanPromiseInjectable); const processCheckingForUpdates = withOrphanPromise(di.inject(processCheckingForUpdatesInjectable)); - return getStartableStoppable("periodical-check-for-updates", () => { + return getSyncStartableStoppable("periodical-check-for-updates", () => { const TWO_HOURS = 1000 * 60 * 60 * 2; processCheckingForUpdates("periodic"); const intervalId = setInterval(() => { - processCheckingForUpdates("periodic"); }, TWO_HOURS); diff --git a/src/features/application-update/child-features/periodical-checking-of-updates/main/start-checking-for-updates.injectable.ts b/src/features/application-update/child-features/periodical-checking-of-updates/main/start-checking-for-updates.injectable.ts index 0292d148df..20b60af2fa 100644 --- a/src/features/application-update/child-features/periodical-checking-of-updates/main/start-checking-for-updates.injectable.ts +++ b/src/features/application-update/child-features/periodical-checking-of-updates/main/start-checking-for-updates.injectable.ts @@ -16,9 +16,9 @@ const startCheckingForUpdatesInjectable = getInjectable({ return { id: "start-checking-for-updates", - run: async () => { + run: () => { if (updatingIsEnabled && !periodicalCheckForUpdates.started) { - await periodicalCheckForUpdates.start(); + periodicalCheckForUpdates.start(); } }, }; diff --git a/src/features/application-update/child-features/periodical-checking-of-updates/main/stop-checking-for-updates.injectable.ts b/src/features/application-update/child-features/periodical-checking-of-updates/main/stop-checking-for-updates.injectable.ts index ff7607e7db..0e2e5e7576 100644 --- a/src/features/application-update/child-features/periodical-checking-of-updates/main/stop-checking-for-updates.injectable.ts +++ b/src/features/application-update/child-features/periodical-checking-of-updates/main/stop-checking-for-updates.injectable.ts @@ -14,9 +14,9 @@ const stopCheckingForUpdatesInjectable = getInjectable({ return { id: "stop-checking-for-updates", - run: async () => { + run: () => { if (periodicalCheckForUpdates.started) { - await periodicalCheckForUpdates.stop(); + periodicalCheckForUpdates.stop(); } }, }; diff --git a/src/features/application-update/main/watch-if-update-should-happen-on-quit/watch-if-update-should-happen-on-quit.injectable.ts b/src/features/application-update/main/watch-if-update-should-happen-on-quit/watch-if-update-should-happen-on-quit.injectable.ts index bcad45a0ac..b9bc431c2a 100644 --- a/src/features/application-update/main/watch-if-update-should-happen-on-quit/watch-if-update-should-happen-on-quit.injectable.ts +++ b/src/features/application-update/main/watch-if-update-should-happen-on-quit/watch-if-update-should-happen-on-quit.injectable.ts @@ -4,7 +4,7 @@ */ import { getInjectable } from "@ogre-tools/injectable"; import { autorun } from "mobx"; -import { getStartableStoppable } from "../../../../common/utils/get-startable-stoppable"; +import { getSyncStartableStoppable } from "../../../../common/utils/get-startable-stoppable"; import setUpdateOnQuitInjectable from "../../../../main/electron-app/features/set-update-on-quit.injectable"; import selectedUpdateChannelInjectable from "../../common/selected-update-channel/selected-update-channel.injectable"; import type { ReleaseChannel, UpdateChannel } from "../../common/update-channels"; @@ -18,7 +18,7 @@ const watchIfUpdateShouldHappenOnQuitInjectable = getInjectable({ const selectedUpdateChannel = di.inject(selectedUpdateChannelInjectable); const discoveredVersionState = di.inject(discoveredUpdateVersionInjectable); - return getStartableStoppable("watch-if-update-should-happen-on-quit", () => + return getSyncStartableStoppable("watch-if-update-should-happen-on-quit", () => autorun(() => { const sufficientlyStableUpdateChannels = getSufficientlyStableUpdateChannels(selectedUpdateChannel.value.get()); const updateIsDiscoveredFromChannel = discoveredVersionState.value.get()?.updateChannel; diff --git a/src/main/catalog-sync-to-renderer/catalog-sync-to-renderer.injectable.ts b/src/main/catalog-sync-to-renderer/catalog-sync-to-renderer.injectable.ts index 7e588481a8..4daf484fd4 100644 --- a/src/main/catalog-sync-to-renderer/catalog-sync-to-renderer.injectable.ts +++ b/src/main/catalog-sync-to-renderer/catalog-sync-to-renderer.injectable.ts @@ -4,7 +4,7 @@ */ import { getInjectable } from "@ogre-tools/injectable"; import { startCatalogSyncToRenderer } from "../catalog-pusher"; -import { getStartableStoppable } from "../../common/utils/get-startable-stoppable"; +import { getSyncStartableStoppable } from "../../common/utils/get-startable-stoppable"; import catalogEntityRegistryInjectable from "../catalog/entity-registry.injectable"; const catalogSyncToRendererInjectable = getInjectable({ @@ -13,7 +13,7 @@ const catalogSyncToRendererInjectable = getInjectable({ instantiate: (di) => { const catalogEntityRegistry = di.inject(catalogEntityRegistryInjectable); - return getStartableStoppable("catalog-sync", () => + return getSyncStartableStoppable("catalog-sync", () => startCatalogSyncToRenderer(catalogEntityRegistry), ); }, diff --git a/src/main/catalog-sync-to-renderer/start-catalog-sync.injectable.ts b/src/main/catalog-sync-to-renderer/start-catalog-sync.injectable.ts index ce06a44281..ebe1f2a1ac 100644 --- a/src/main/catalog-sync-to-renderer/start-catalog-sync.injectable.ts +++ b/src/main/catalog-sync-to-renderer/start-catalog-sync.injectable.ts @@ -14,9 +14,9 @@ const startCatalogSyncInjectable = getInjectable({ return { id: "start-catalog-sync", - run: async () => { + run: () => { if (!catalogSyncToRenderer.started) { - await catalogSyncToRenderer.start(); + catalogSyncToRenderer.start(); } }, }; diff --git a/src/main/catalog-sync-to-renderer/stop-catalog-sync.injectable.ts b/src/main/catalog-sync-to-renderer/stop-catalog-sync.injectable.ts index fcd294fe02..e2e94a5805 100644 --- a/src/main/catalog-sync-to-renderer/stop-catalog-sync.injectable.ts +++ b/src/main/catalog-sync-to-renderer/stop-catalog-sync.injectable.ts @@ -14,9 +14,9 @@ const stopCatalogSyncInjectable = getInjectable({ return { id: "stop-catalog-sync", - run: async () => { + run: () => { if (catalogSyncToRenderer.started) { - await catalogSyncToRenderer.stop(); + catalogSyncToRenderer.stop(); } }, }; diff --git a/src/main/electron-app/features/sync-theme-from-operating-system.injectable.ts b/src/main/electron-app/features/sync-theme-from-operating-system.injectable.ts index fa2f8e335e..e0eded9ad6 100644 --- a/src/main/electron-app/features/sync-theme-from-operating-system.injectable.ts +++ b/src/main/electron-app/features/sync-theme-from-operating-system.injectable.ts @@ -3,7 +3,7 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectable } from "@ogre-tools/injectable"; -import { getStartableStoppable } from "../../../common/utils/get-startable-stoppable"; +import { getSyncStartableStoppable } from "../../../common/utils/get-startable-stoppable"; import operatingSystemThemeStateInjectable from "../../theme/operating-system-theme-state.injectable"; import nativeThemeInjectable from "./native-theme.injectable"; import getElectronThemeInjectable from "./get-electron-theme.injectable"; @@ -16,11 +16,9 @@ const syncThemeFromOperatingSystemInjectable = getInjectable({ const nativeTheme = di.inject(nativeThemeInjectable); const getElectronTheme = di.inject(getElectronThemeInjectable); - return getStartableStoppable("sync-theme-from-operating-system", () => { + return getSyncStartableStoppable("sync-theme-from-operating-system", () => { const updateThemeState = () => { - const newTheme = getElectronTheme(); - - currentThemeState.set(newTheme); + currentThemeState.set(getElectronTheme()); }; nativeTheme.on("updated", updateThemeState); diff --git a/src/main/electron-app/runnables/setup-runnables-before-closing-of-application.injectable.ts b/src/main/electron-app/runnables/setup-runnables-before-closing-of-application.injectable.ts index 5e8b24c2d8..2c8b96f5f9 100644 --- a/src/main/electron-app/runnables/setup-runnables-before-closing-of-application.injectable.ts +++ b/src/main/electron-app/runnables/setup-runnables-before-closing-of-application.injectable.ts @@ -16,14 +16,8 @@ const setupRunnablesBeforeClosingOfApplicationInjectable = getInjectable({ instantiate: (di) => { const runMany = runManySyncFor(di); - - const runRunnablesBeforeQuitOfFrontEnd = runMany( - beforeQuitOfFrontEndInjectionToken, - ); - - const runRunnablesBeforeQuitOfBackEnd = runMany( - beforeQuitOfBackEndInjectionToken, - ); + const runRunnablesBeforeQuitOfFrontEnd = runMany(beforeQuitOfFrontEndInjectionToken); + const runRunnablesBeforeQuitOfBackEnd = runMany(beforeQuitOfBackEndInjectionToken); return { id: "setup-closing-of-application", diff --git a/src/main/theme/broadcast-theme-change/broadcast-theme-change.injectable.ts b/src/main/theme/broadcast-theme-change/broadcast-theme-change.injectable.ts index 98be53d748..79db25ff40 100644 --- a/src/main/theme/broadcast-theme-change/broadcast-theme-change.injectable.ts +++ b/src/main/theme/broadcast-theme-change/broadcast-theme-change.injectable.ts @@ -4,7 +4,7 @@ */ import { getInjectable } from "@ogre-tools/injectable"; import { reaction } from "mobx"; -import { getStartableStoppable } from "../../../common/utils/get-startable-stoppable"; +import { getSyncStartableStoppable } from "../../../common/utils/get-startable-stoppable"; import { setNativeThemeChannel } from "../../../common/ipc/native-theme"; import operatingSystemThemeInjectable from "../operating-system-theme.injectable"; import broadcastMessageInjectable from "../../../common/ipc/broadcast-message.injectable"; @@ -16,7 +16,7 @@ const broadcastThemeChangeInjectable = getInjectable({ const currentTheme = di.inject(operatingSystemThemeInjectable); const broadcastMessage = di.inject(broadcastMessageInjectable); - return getStartableStoppable("broadcast-theme-change", () => + return getSyncStartableStoppable("broadcast-theme-change", () => reaction(() => currentTheme.get(), (theme) => { broadcastMessage(setNativeThemeChannel, theme); }), diff --git a/src/main/theme/broadcast-theme-change/start-broadcasting-theme-change.injectable.ts b/src/main/theme/broadcast-theme-change/start-broadcasting-theme-change.injectable.ts index e76f251ec2..aa7b7959bd 100644 --- a/src/main/theme/broadcast-theme-change/start-broadcasting-theme-change.injectable.ts +++ b/src/main/theme/broadcast-theme-change/start-broadcasting-theme-change.injectable.ts @@ -14,8 +14,8 @@ const startBroadcastingThemeChangeInjectable = getInjectable({ return { id: "start-broadcasting-theme-change", - run: async () => { - await broadcastThemeChange.start(); + run: () => { + broadcastThemeChange.start(); }, }; }, diff --git a/src/main/theme/broadcast-theme-change/stop-broadcasting-theme-change.injectable.ts b/src/main/theme/broadcast-theme-change/stop-broadcasting-theme-change.injectable.ts index 81f530ad9b..bd83154e01 100644 --- a/src/main/theme/broadcast-theme-change/stop-broadcasting-theme-change.injectable.ts +++ b/src/main/theme/broadcast-theme-change/stop-broadcasting-theme-change.injectable.ts @@ -14,8 +14,8 @@ const stopBroadcastingThemeChangeInjectable = getInjectable({ return { id: "stop-broadcasting-theme-change", - run: async () => { - await broadcastThemeChange.stop(); + run: () => { + broadcastThemeChange.stop(); }, }; }, diff --git a/src/main/theme/sync-theme-from-os/start-syncing-theme-from-operating-system.injectable.ts b/src/main/theme/sync-theme-from-os/start-syncing-theme-from-operating-system.injectable.ts index adc22c4e1e..d5c8f51c76 100644 --- a/src/main/theme/sync-theme-from-os/start-syncing-theme-from-operating-system.injectable.ts +++ b/src/main/theme/sync-theme-from-os/start-syncing-theme-from-operating-system.injectable.ts @@ -14,8 +14,8 @@ const startSyncingThemeFromOperatingSystemInjectable = getInjectable({ return { id: "start-syncing-theme-from-operating-system", - run: async () => { - await syncTheme.start(); + run: () => { + syncTheme.start(); }, }; }, diff --git a/src/main/theme/sync-theme-from-os/stop-syncing-theme-from-operating-system.injectable.ts b/src/main/theme/sync-theme-from-os/stop-syncing-theme-from-operating-system.injectable.ts index 8a11042883..51986f1cfc 100644 --- a/src/main/theme/sync-theme-from-os/stop-syncing-theme-from-operating-system.injectable.ts +++ b/src/main/theme/sync-theme-from-os/stop-syncing-theme-from-operating-system.injectable.ts @@ -14,8 +14,8 @@ const stopSyncingThemeFromOperatingSystemInjectable = getInjectable({ return { id: "stop-syncing-theme-from-operating-system", - run: async () => { - await syncTheme.stop(); + run: () => { + syncTheme.stop(); }, }; }, diff --git a/src/main/tray/menu-icon/reactive.injectable.ts b/src/main/tray/menu-icon/reactive.injectable.ts index 8c6d358477..29124d193e 100644 --- a/src/main/tray/menu-icon/reactive.injectable.ts +++ b/src/main/tray/menu-icon/reactive.injectable.ts @@ -4,7 +4,7 @@ */ import { getInjectable } from "@ogre-tools/injectable"; import { reaction } from "mobx"; -import { getStartableStoppable } from "../../../common/utils/get-startable-stoppable"; +import { getSyncStartableStoppable } from "../../../common/utils/get-startable-stoppable"; import electronTrayInjectable from "../electron-tray/electron-tray.injectable"; import trayIconInjectable from "./tray-icon.injectable"; @@ -15,7 +15,7 @@ const reactiveTrayMenuIconInjectable = getInjectable({ const trayMenuIcon = di.inject(trayIconInjectable); const electronTray = di.inject(electronTrayInjectable); - return getStartableStoppable("reactive-tray-menu-icon", () => ( + return getSyncStartableStoppable("reactive-tray-menu-icon", () => ( reaction( () => trayMenuIcon.get(), icon => { diff --git a/src/main/tray/menu-icon/start-reactivity.injectable.ts b/src/main/tray/menu-icon/start-reactivity.injectable.ts index 19bc9aec20..2c03735904 100644 --- a/src/main/tray/menu-icon/start-reactivity.injectable.ts +++ b/src/main/tray/menu-icon/start-reactivity.injectable.ts @@ -15,8 +15,8 @@ const startReactiveTrayMenuIconInjectable = getInjectable({ return { id: "start-reactive-tray-menu-icon", - run: async () => { - await reactiveTrayMenuIcon.start(); + run: () => { + reactiveTrayMenuIcon.start(); }, runAfter: di.inject(startTrayInjectable), diff --git a/src/main/tray/menu-icon/stop-reactivity.injectable.ts b/src/main/tray/menu-icon/stop-reactivity.injectable.ts index b43661807d..0f1028807e 100644 --- a/src/main/tray/menu-icon/stop-reactivity.injectable.ts +++ b/src/main/tray/menu-icon/stop-reactivity.injectable.ts @@ -14,8 +14,8 @@ const stopReactiveTrayMenuIconInjectable = getInjectable({ return { id: "stop-reactive-tray-menu-icon", - run: async () => { - await reactiveTrayMenuIcon.stop(); + run: () => { + reactiveTrayMenuIcon.stop(); }, }; }, diff --git a/src/main/tray/reactive-tray-menu-items/reactive-tray-menu-items.injectable.ts b/src/main/tray/reactive-tray-menu-items/reactive-tray-menu-items.injectable.ts index 145cc1e870..c5aa7af528 100644 --- a/src/main/tray/reactive-tray-menu-items/reactive-tray-menu-items.injectable.ts +++ b/src/main/tray/reactive-tray-menu-items/reactive-tray-menu-items.injectable.ts @@ -3,7 +3,7 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectable } from "@ogre-tools/injectable"; -import { getStartableStoppable } from "../../../common/utils/get-startable-stoppable"; +import { getSyncStartableStoppable } from "../../../common/utils/get-startable-stoppable"; import { reaction } from "mobx"; import type { MinimalTrayMenuItem } from "../electron-tray/electron-tray.injectable"; import electronTrayInjectable from "../electron-tray/electron-tray.injectable"; @@ -17,7 +17,7 @@ const reactiveTrayMenuItemsInjectable = getInjectable({ const electronTray = di.inject(electronTrayInjectable); const reactiveItems = di.inject(trayMenuItemsInjectable); - return getStartableStoppable("reactive-tray-menu-items", () => + return getSyncStartableStoppable("reactive-tray-menu-items", () => reaction( (): MinimalTrayMenuItem[] => reactiveItems.get().map(toNonReactiveItem), diff --git a/src/main/tray/reactive-tray-menu-items/start-reactive-tray-menu-items.injectable.ts b/src/main/tray/reactive-tray-menu-items/start-reactive-tray-menu-items.injectable.ts index 7abd07e91b..634c6cd875 100644 --- a/src/main/tray/reactive-tray-menu-items/start-reactive-tray-menu-items.injectable.ts +++ b/src/main/tray/reactive-tray-menu-items/start-reactive-tray-menu-items.injectable.ts @@ -15,8 +15,8 @@ const startReactiveTrayMenuItemsInjectable = getInjectable({ return { id: "start-reactive-tray-menu-items", - run: async () => { - await reactiveTrayMenuItems.start(); + run: () => { + reactiveTrayMenuItems.start(); }, runAfter: di.inject(startTrayInjectable), diff --git a/src/main/tray/reactive-tray-menu-items/stop-reactive-tray-menu-items.injectable.ts b/src/main/tray/reactive-tray-menu-items/stop-reactive-tray-menu-items.injectable.ts index dbf5753c23..b12e1c9f01 100644 --- a/src/main/tray/reactive-tray-menu-items/stop-reactive-tray-menu-items.injectable.ts +++ b/src/main/tray/reactive-tray-menu-items/stop-reactive-tray-menu-items.injectable.ts @@ -14,8 +14,8 @@ const stopReactiveTrayMenuItemsInjectable = getInjectable({ return { id: "stop-reactive-tray-menu-items", - run: async () => { - await reactiveTrayMenuItems.stop(); + run: () => { + reactiveTrayMenuItems.stop(); }, }; }, diff --git a/src/main/utils/channel/channel-listeners/listening-on-request-channels.injectable.ts b/src/main/utils/channel/channel-listeners/listening-on-request-channels.injectable.ts index 80b94fbe0e..8aac28af3d 100644 --- a/src/main/utils/channel/channel-listeners/listening-on-request-channels.injectable.ts +++ b/src/main/utils/channel/channel-listeners/listening-on-request-channels.injectable.ts @@ -5,7 +5,7 @@ import { getInjectable } from "@ogre-tools/injectable"; import { disposer } from "../../../../common/utils"; import type { RequestChannel } from "../../../../common/utils/channel/request-channel-listener-injection-token"; -import { getStartableStoppable } from "../../../../common/utils/get-startable-stoppable"; +import { getSyncStartableStoppable } from "../../../../common/utils/get-startable-stoppable"; import enlistRequestChannelListenerInjectable from "./enlist-request-channel-listener.injectable"; import { requestChannelListenerInjectionToken } from "./listener-tokens"; @@ -15,7 +15,7 @@ const listeningOnRequestChannelsInjectable = getInjectable({ const enlistRequestChannelListener = di.inject(enlistRequestChannelListenerInjectable); const requestChannelListeners = di.injectMany(requestChannelListenerInjectionToken); - return getStartableStoppable("listening-on-request-channels", () => { + return getSyncStartableStoppable("listening-on-request-channels", () => { const seenChannels = new Set>(); for (const listener of requestChannelListeners) { diff --git a/src/main/utils/channel/channel-listeners/start-listening-on-channels.injectable.ts b/src/main/utils/channel/channel-listeners/start-listening-on-channels.injectable.ts index d1cf5d68d6..ce6008add4 100644 --- a/src/main/utils/channel/channel-listeners/start-listening-on-channels.injectable.ts +++ b/src/main/utils/channel/channel-listeners/start-listening-on-channels.injectable.ts @@ -16,9 +16,9 @@ const startListeningOnChannelsInjectable = getInjectable({ return { id: "start-listening-on-channels-main", - run: async () => { - await listeningOnMessageChannels.start(); - await listeningOnRequestChannels.start(); + run: () => { + listeningOnMessageChannels.start(); + listeningOnRequestChannels.start(); }, }; },