This commit is contained in:
Manav Rathi
2024-05-31 14:11:16 +05:30
parent 3ad8f73289
commit c8d30323e4

View File

@@ -87,6 +87,7 @@ import {
import downloadManager from "services/download";
import { syncCLIPEmbeddings } from "services/embeddingService";
import { syncEntities } from "services/entityService";
import { fetchAndSaveFeatureFlags } from "services/feature-flag";
import { getLocalFiles, syncFiles } from "services/fileService";
import locationSearchService from "services/locationSearchService";
import { getLocalTrashedFiles, syncTrash } from "services/trashService";
@@ -340,6 +341,7 @@ export default function Gallery() {
return;
}
preloadImage("/images/subscription-card-background");
let ffTimeout: ReturnType<typeof setTimeout> | undefined;
const electron = globalThis.electron;
const main = async () => {
const valid = await validateKey();
@@ -383,6 +385,11 @@ export default function Gallery() {
syncInterval.current = setInterval(() => {
syncWithRemote(false, true);
}, SYNC_INTERVAL_IN_MICROSECONDS);
// Not critical, so fetch these after some delay.
ffTimeout = setTimeout(() => {
ffTimeout = undefined;
void fetchAndSaveFeatureFlags();
}, 5000);
if (electron) {
// void clipService.setupOnFileUploadListener();
electron.onMainWindowFocus(() => syncWithRemote(false, true));
@@ -391,6 +398,7 @@ export default function Gallery() {
main();
return () => {
clearInterval(syncInterval.current);
if (ffTimeout) clearTimeout(ffTimeout);
if (electron) {
electron.onMainWindowFocus(undefined);
clipService.removeOnFileUploadListener();