MCPcopy Create free account
hub / github.com/alexankitty/Myrient-Search-Engine / getFilesJob

Function getFilesJob

server.js:83–116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

81let metadataManager = new MetadataManager();
82
83async function getFilesJob() {
84 updatingFiles = true;
85 console.log("Updating the file list.");
86 let oldFileCount = fileCount || 0;
87 fileCount = await getAllFiles(categoryList);
88 if (!fileCount) {
89 console.log("File update failed");
90 return;
91 }
92 crawlTime = Date.now();
93 console.log(`Finished updating file list. ${fileCount} found.`);
94 if (fileCount > oldFileCount) {
95 if (
96 (await Metadata.count()) < (await metadataManager.getIGDBGamesCount())
97 ) {
98 await metadataManager.syncAllMetadata();
99 }
100 await metadataManager.matchAllMetadata();
101 metadataMatchCount = await File.count({
102 where: { detailsId: { [Op.ne]: null } },
103 });
104 if (process.env.DB_KEYWORD_OPTIMIZER === "1") {
105 await optimizeDatabaseKws();
106 }
107 }
108 //this is less important and needs to run last.
109 if (fileCount > oldFileCount && (await Metadata.count())) {
110 metadataManager.matchAllMetadata(true);
111 }
112 metadataMatchCount = await File.count({
113 where: { detailsId: { [Op.ne]: null } },
114 });
115 updatingFiles = false;
116}
117
118async function updateMetadata() {
119 if (updatingFiles) return;

Callers 1

server.jsFile · 0.85

Calls 5

optimizeDatabaseKwsFunction · 0.90
getAllFilesFunction · 0.85
getIGDBGamesCountMethod · 0.80
syncAllMetadataMethod · 0.80
matchAllMetadataMethod · 0.80

Tested by

no test coverage detected