Skip to content

Commit a003329

Browse files
committed
minor order of operations tweak
1 parent 6ca11df commit a003329

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

server.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,15 @@ async function getFilesJob() {
9696
(await Metadata.count()) < (await metadataManager.getIGDBGamesCount())
9797
) {
9898
await metadataManager.syncAllMetadata();
99-
await metadataManager.matchAllMetadata();
100-
metadataMatchCount = await File.count({
101-
where: { detailsId: { [Op.ne]: null } },
102-
});
10399
}
100+
await metadataManager.matchAllMetadata();
101+
metadataMatchCount = await File.count({
102+
where: { detailsId: { [Op.ne]: null } },
103+
});
104104
await optimizeDatabaseKws();
105105
}
106106
//this is less important and needs to run last.
107-
if (fileCount > oldFileCount && await Metadata.count()) {
107+
if (fileCount > oldFileCount && (await Metadata.count())) {
108108
metadataManager.matchAllMetadata(true);
109109
}
110110
metadataMatchCount = await File.count({
@@ -117,7 +117,7 @@ async function updateMetadata() {
117117
if (updatingFiles) return;
118118
if ((await Metadata.count()) < (await metadataManager.getIGDBGamesCount())) {
119119
await metadataManager.syncAllMetadata();
120-
if(await Metadata.count()){
120+
if (await Metadata.count()) {
121121
await metadataManager.matchAllMetadata();
122122
}
123123
metadataMatchCount = await File.count({
@@ -128,7 +128,7 @@ async function updateMetadata() {
128128

129129
async function updateKws() {
130130
if (updatingFiles) return;
131-
if (!await File.count({ where: { filenamekws: { [Op.ne]: null } } })) {
131+
if (!(await File.count({ where: { filenamekws: { [Op.ne]: null } } }))) {
132132
await optimizeDatabaseKws();
133133
}
134134
}
@@ -232,7 +232,7 @@ app.get("/search", async function (req, res) {
232232
let urlPrefix = encodeURI(
233233
`/search?s=${req.query.s}&q=${req.query.q}${
234234
req.query.o ? "&o=" + req.query.o : ""
235-
}${loadOldResults ? '&old=true': ''}&p=`
235+
}${loadOldResults ? "&old=true" : ""}&p=`
236236
);
237237
pageNum = pageNum ? pageNum : 1;
238238
let settings = {};
@@ -615,5 +615,5 @@ if (
615615
cron.schedule("0 30 2 * * *", getFilesJob);
616616

617617
//run these tasks after to add new functions
618-
await updateMetadata()
619-
await updateKws()
618+
await updateMetadata();
619+
await updateKws();

0 commit comments

Comments
 (0)