2022-04-04 19:15:29 +00:00
|
|
|
import database from '../database';
|
2022-02-10 12:10:42 +00:00
|
|
|
|
2022-04-28 20:37:25 +00:00
|
|
|
export async function clearCache({ server }: { server: string }): Promise<void> {
|
2022-02-10 12:10:42 +00:00
|
|
|
try {
|
|
|
|
const serversDB = database.servers;
|
|
|
|
await serversDB.write(async () => {
|
|
|
|
const serverCollection = serversDB.get('servers');
|
|
|
|
const serverRecord = await serverCollection.find(server);
|
|
|
|
await serverRecord.update(s => {
|
|
|
|
s.roomsUpdatedAt = null;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} catch (e) {
|
|
|
|
// Do nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
const db = database.active;
|
|
|
|
await db.write(() => db.unsafeResetDatabase());
|
|
|
|
} catch (e) {
|
|
|
|
// Do nothing
|
|
|
|
}
|
|
|
|
}
|