server: query cache is optional

The query cache can be disabled in the configuration file and should
thus be considered optional. It should not be assumed that it is present.
This commit is contained in:
Johann150 2024-07-19 20:45:25 +02:00
parent c0364f236c
commit 67089193ea
Signed by: Johann150
GPG key ID: 9EE6577A2A06F8F1
10 changed files with 12 additions and 12 deletions

View file

@ -73,7 +73,7 @@ export async function importCustomEmojis(job: Bull.Job<DbUserImportJobData>, don
}); });
} }
await db.queryResultCache!.remove(['meta_emojis']); await db.queryResultCache?.remove(['meta_emojis']);
cleanup(); cleanup();

View file

@ -36,5 +36,5 @@ export default define(meta, paramDef, async (ps) => {
}); });
} }
await db.queryResultCache!.remove(['meta_emojis']); await db.queryResultCache?.remove(['meta_emojis']);
}); });

View file

@ -43,7 +43,7 @@ export default define(meta, paramDef, async (ps, me) => {
type: file.webpublicType ?? file.type, type: file.webpublicType ?? file.type,
}).then(x => Emojis.findOneByOrFail(x.identifiers[0])); }).then(x => Emojis.findOneByOrFail(x.identifiers[0]));
await db.queryResultCache!.remove(['meta_emojis']); await db.queryResultCache?.remove(['meta_emojis']);
publishBroadcastStream('emojiAdded', { publishBroadcastStream('emojiAdded', {
emoji: await Emojis.pack(emoji.id), emoji: await Emojis.pack(emoji.id),

View file

@ -62,7 +62,7 @@ export default define(meta, paramDef, async (ps) => {
type: driveFile.webpublicType ?? driveFile.type, type: driveFile.webpublicType ?? driveFile.type,
}).then(x => Emojis.findOneByOrFail(x.identifiers[0])); }).then(x => Emojis.findOneByOrFail(x.identifiers[0]));
await db.queryResultCache!.remove(['meta_emojis']); await db.queryResultCache?.remove(['meta_emojis']);
publishBroadcastStream('emojiAdded', { publishBroadcastStream('emojiAdded', {
emoji: await Emojis.pack(copied.id), emoji: await Emojis.pack(copied.id),

View file

@ -29,9 +29,9 @@ export default define(meta, paramDef, async (ps, me) => {
for (const emoji of emojis) { for (const emoji of emojis) {
await Emojis.delete(emoji.id); await Emojis.delete(emoji.id);
await db.queryResultCache!.remove(['meta_emojis']); await db.queryResultCache?.remove(['meta_emojis']);
insertModerationLog(me, 'deleteEmoji', { emoji }); insertModerationLog(me, 'deleteEmoji', { emoji });
} }
}); });

View file

@ -29,7 +29,7 @@ export default define(meta, paramDef, async (ps, me) => {
await Emojis.delete(emoji.id); await Emojis.delete(emoji.id);
await db.queryResultCache!.remove(['meta_emojis']); await db.queryResultCache?.remove(['meta_emojis']);
insertModerationLog(me, 'deleteEmoji', { emoji }); insertModerationLog(me, 'deleteEmoji', { emoji });
}); });

View file

@ -36,5 +36,5 @@ export default define(meta, paramDef, async (ps) => {
}); });
} }
await db.queryResultCache!.remove(['meta_emojis']); await db.queryResultCache?.remove(['meta_emojis']);
}); });

View file

@ -32,5 +32,5 @@ export default define(meta, paramDef, async (ps) => {
aliases: ps.aliases, aliases: ps.aliases,
}); });
await db.queryResultCache!.remove(['meta_emojis']); await db.queryResultCache?.remove(['meta_emojis']);
}); });

View file

@ -34,5 +34,5 @@ export default define(meta, paramDef, async (ps) => {
category: ps.category, category: ps.category,
}); });
await db.queryResultCache!.remove(['meta_emojis']); await db.queryResultCache?.remove(['meta_emojis']);
}); });

View file

@ -42,5 +42,5 @@ export default define(meta, paramDef, async (ps) => {
aliases: ps.aliases, aliases: ps.aliases,
}); });
await db.queryResultCache!.remove(['meta_emojis']); await db.queryResultCache?.remove(['meta_emojis']);
}); });