mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-11-14 08:17:26 +01:00
fix: bound metadata work and distinguish cancelled requests (#951)
This commit is contained in:
1 parent
ed07ecde73
commit
d508ab1754
14 files changed
+202
-16
No files matched your search
@@ -0,0 +1,15 @@
|
||||
import FileModel from "./model/files/files.model";
|
||||
|
||||
export async function hasVisibleSubmodules(repoId: string, generation?: string): Promise<boolean> {
|
||||
const scope = { repoId, treeGeneration: generation || { $exists: false } };
|
||||
// Separate probes prevent the OR planner choosing a scan of every generation row.
|
||||
if (await FileModel.exists({ ...scope, name: ".gitmodules", path: "" })) return true;
|
||||
const filter = { ...scope, submodule: { $exists: true, $ne: "included" } };
|
||||
try { return !!await FileModel.exists(filter).hint("file_submodule_status"); }
|
||||
catch (error) {
|
||||
// Rolling upgrades may receive requests before the additive index is installed.
|
||||
const failure = error as { code?: number; message?: string };
|
||||
if (failure.code !== 2 || !/hint.*(?:index|existing)/i.test(failure.message || "")) throw error;
|
||||
return !!await FileModel.exists(filter);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user