refactor: update meta cache only on update
This commit is contained in:
parent
58791e6e55
commit
145cba9ae5
3 changed files with 6 additions and 4 deletions
|
@ -1,4 +0,0 @@
|
|||
import { fetchMeta } from "@/misc/backend-rs.js";
|
||||
|
||||
// refresh cache
|
||||
setInterval(() => fetchMeta(true), 1000 * 10);
|
|
@ -2,6 +2,7 @@ import config from "@/config/index.js";
|
|||
import { Meta } from "@/models/entities/meta.js";
|
||||
import { insertModerationLog } from "@/services/insert-moderation-log.js";
|
||||
import { db } from "@/db/postgre.js";
|
||||
import { fetchMeta } from "@/misc/backend-rs.js";
|
||||
import define from "@/server/api/define.js";
|
||||
|
||||
export const meta = {
|
||||
|
@ -120,6 +121,8 @@ export default define(meta, paramDef, async (ps, me) => {
|
|||
} else {
|
||||
await transactionalEntityManager.save(Meta, set);
|
||||
}
|
||||
// update meta cache
|
||||
fetchMeta(true);
|
||||
});
|
||||
insertModerationLog(me, "updateMeta");
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { Meta } from "@/models/entities/meta.js";
|
||||
import { insertModerationLog } from "@/services/insert-moderation-log.js";
|
||||
import { db } from "@/db/postgre.js";
|
||||
import { fetchMeta } from "@/misc/backend-rs.js";
|
||||
import define from "@/server/api/define.js";
|
||||
|
||||
export const meta = {
|
||||
|
@ -571,6 +572,8 @@ export default define(meta, paramDef, async (ps, me) => {
|
|||
} else {
|
||||
await transactionalEntityManager.save(Meta, set);
|
||||
}
|
||||
// update meta cache
|
||||
fetchMeta(true);
|
||||
});
|
||||
|
||||
insertModerationLog(me, "updateMeta");
|
||||
|
|
Loading…
Reference in a new issue