Update Emojis immediately (#5106)
This commit is contained in:
parent
a8f945ae8e
commit
d5caf22d8c
|
@ -3,6 +3,7 @@ import define from '../../../define';
|
||||||
import { detectUrlMine } from '../../../../../misc/detect-url-mine';
|
import { detectUrlMine } from '../../../../../misc/detect-url-mine';
|
||||||
import { Emojis } from '../../../../../models';
|
import { Emojis } from '../../../../../models';
|
||||||
import { genId } from '../../../../../misc/gen-id';
|
import { genId } from '../../../../../misc/gen-id';
|
||||||
|
import { getConnection } from 'typeorm';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
desc: {
|
desc: {
|
||||||
|
@ -43,6 +44,8 @@ export default define(meta, async (ps) => {
|
||||||
type,
|
type,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await getConnection().queryResultCache!.remove(['meta_emojis']);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: emoji.id
|
id: emoji.id
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,6 +2,7 @@ import $ from 'cafy';
|
||||||
import define from '../../../define';
|
import define from '../../../define';
|
||||||
import { ID } from '../../../../../misc/cafy-id';
|
import { ID } from '../../../../../misc/cafy-id';
|
||||||
import { Emojis } from '../../../../../models';
|
import { Emojis } from '../../../../../models';
|
||||||
|
import { getConnection } from 'typeorm';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
desc: {
|
desc: {
|
||||||
|
@ -26,4 +27,6 @@ export default define(meta, async (ps) => {
|
||||||
if (emoji == null) throw new Error('emoji not found');
|
if (emoji == null) throw new Error('emoji not found');
|
||||||
|
|
||||||
await Emojis.delete(emoji.id);
|
await Emojis.delete(emoji.id);
|
||||||
|
|
||||||
|
await getConnection().queryResultCache!.remove(['meta_emojis']);
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,6 +3,7 @@ import define from '../../../define';
|
||||||
import { detectUrlMine } from '../../../../../misc/detect-url-mine';
|
import { detectUrlMine } from '../../../../../misc/detect-url-mine';
|
||||||
import { ID } from '../../../../../misc/cafy-id';
|
import { ID } from '../../../../../misc/cafy-id';
|
||||||
import { Emojis } from '../../../../../models';
|
import { Emojis } from '../../../../../models';
|
||||||
|
import { getConnection } from 'typeorm';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
desc: {
|
desc: {
|
||||||
|
@ -47,4 +48,6 @@ export default define(meta, async (ps) => {
|
||||||
url: ps.url,
|
url: ps.url,
|
||||||
type,
|
type,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await getConnection().queryResultCache!.remove(['meta_emojis']);
|
||||||
});
|
});
|
||||||
|
|
|
@ -95,7 +95,7 @@ export const meta = {
|
||||||
export default define(meta, async (ps, me) => {
|
export default define(meta, async (ps, me) => {
|
||||||
const instance = await fetchMeta(true);
|
const instance = await fetchMeta(true);
|
||||||
|
|
||||||
const emojis = await Emojis.find({ where: { host: null }, cache: 3600000 }); // 1 hour
|
const emojis = await Emojis.find({ where: { host: null }, cache: { id: 'meta_emojis', milliseconds: 3600000 } }); // 1 hour
|
||||||
|
|
||||||
const response: any = {
|
const response: any = {
|
||||||
maintainerName: instance.maintainerName,
|
maintainerName: instance.maintainerName,
|
||||||
|
|
Loading…
Reference in a new issue