Fix catalog syncer long delay (#4911)

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen authored and GitHub committed 2022-02-23 06:52:43 +02:00
1 parent 9c604dcfa1
commit 12a6bd8512
2 files changed
+7 -3

No files matched your search

+5 -1
View File
@@ -14,9 +14,13 @@ import { catalogInitChannel, catalogItemsChannel } from "../common/ipc/catalog";
const broadcaster = debounce((items: CatalogEntity[]) => {
broadcastMessage(catalogItemsChannel, items);
}, 1_000, { leading: true, trailing: true });
}, 100, { leading: true, trailing: true });
export function pushCatalogToRenderer(catalog: CatalogEntityRegistry) {
broadcaster(toJS(catalog.items));
}
export function startCatalogSyncToRenderer(catalog: CatalogEntityRegistry) {
return disposer(
ipcMainOn(catalogInitChannel, () => broadcaster(toJS(catalog.items))),
reaction(() => toJS(catalog.items), (items) => {
+2 -2
View File
@@ -26,7 +26,7 @@ import { disposer, getAppVersion, getAppVersionFromProxyServer } from "../common
import { ipcMainOn } from "../common/ipc";
import { startUpdateChecking } from "./app-updater";
import { IpcRendererNavigationEvents } from "../renderer/navigation/events";
import { pushCatalogToRenderer } from "./catalog-pusher";
import { startCatalogSyncToRenderer } from "./catalog-pusher";
import { catalogEntityRegistry } from "./catalog";
import { HelmRepoManager } from "./helm/helm-repo-manager";
import { syncGeneralEntities, syncWeblinks } from "./catalog-sources";
@@ -244,7 +244,7 @@ di.runSetups().then(() => {
}
ipcMainOn(IpcRendererNavigationEvents.LOADED, async () => {
onCloseCleanup.push(pushCatalogToRenderer(catalogEntityRegistry));
onCloseCleanup.push(startCatalogSyncToRenderer(catalogEntityRegistry));
const directoryForKubeConfigs = di.inject(directoryForKubeConfigsInjectable);