Set cgroups
This commit is contained in:
@@ -6,7 +6,10 @@ import {
|
||||
getLocalFiles,
|
||||
getLocalTrashedFiles,
|
||||
} from "@/new/photos/services/files";
|
||||
import { wipClusterEnable } from "@/new/photos/services/ml";
|
||||
import {
|
||||
wipClusterEnable,
|
||||
wipHasSwitchedOnceCmpAndSet,
|
||||
} from "@/new/photos/services/ml";
|
||||
import { EnteFile } from "@/new/photos/types/file";
|
||||
import { mergeMetadata } from "@/new/photos/utils/file";
|
||||
import { CenteredFlex } from "@ente/shared/components/Container";
|
||||
@@ -674,9 +677,11 @@ export default function Gallery() {
|
||||
// TODO-Cluster
|
||||
if (process.env.NEXT_PUBLIC_ENTE_WIP_CL) {
|
||||
setTimeout(() => {
|
||||
void wipClusterEnable().then(
|
||||
(y) => y && router.push("cluster-debug"),
|
||||
);
|
||||
if (!wipHasSwitchedOnceCmpAndSet()) {
|
||||
void wipClusterEnable().then(
|
||||
(y) => y && router.push("cluster-debug"),
|
||||
);
|
||||
}
|
||||
}, 2000);
|
||||
}
|
||||
}, []);
|
||||
|
||||
@@ -337,6 +337,13 @@ export const wipClusterEnable = async (): Promise<boolean> =>
|
||||
// // TODO-Cluster temporary state here
|
||||
let _wip_isClustering = false;
|
||||
let _wip_searchPersons: SearchPerson[] | undefined;
|
||||
let _wip_hasSwitchedOnce = false;
|
||||
|
||||
export const wipHasSwitchedOnceCmpAndSet = () => {
|
||||
if (_wip_hasSwitchedOnce) return true;
|
||||
_wip_hasSwitchedOnce = true;
|
||||
return false;
|
||||
};
|
||||
|
||||
export const wipSearchPersons = async () => {
|
||||
if (!(await wipClusterEnable())) return [];
|
||||
@@ -370,10 +377,10 @@ export const wipClusterDebugPageContents = async (): Promise<
|
||||
_wip_searchPersons = undefined;
|
||||
triggerStatusUpdate();
|
||||
|
||||
const { faceAndNeigbours, clusters } = await clusterFaces(
|
||||
const { faceAndNeigbours, clusters, cgroups } = await clusterFaces(
|
||||
await faceIndexes(),
|
||||
);
|
||||
// const searchPersons = await convertToSearchPersons(clusters, cgroups);
|
||||
const searchPersons = await convertToSearchPersons(clusters, cgroups);
|
||||
|
||||
const localFiles = await getAllLocalFiles();
|
||||
const localFileByID = new Map(localFiles.map((f) => [f.id, f]));
|
||||
@@ -398,10 +405,9 @@ export const wipClusterDebugPageContents = async (): Promise<
|
||||
);
|
||||
|
||||
_wip_isClustering = false;
|
||||
// _wip_searchPersons = searchPersons;
|
||||
_wip_searchPersons = searchPersons;
|
||||
triggerStatusUpdate();
|
||||
|
||||
// return { faces, clusters, cgroups };
|
||||
return { faceFNs, clusters, clusterIDForFaceID };
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user