2022-04-28 18:45:00 +00:00
|
|
|
import database from '../database';
|
2022-02-28 18:00:47 +00:00
|
|
|
|
2022-05-30 22:02:08 +00:00
|
|
|
export async function clearCache({ server }: { server: string }): Promise<void> {
|
2022-02-28 18:00:47 +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
|
|
|
|
}
|
|
|
|
}
|