mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-26 11:57:34 -07:00
Clean up
This commit is contained in:
parent
e7b51e500b
commit
c5df8bbda0
3 changed files with 0 additions and 29 deletions
|
@ -15,13 +15,6 @@ export class Note {
|
||||||
})
|
})
|
||||||
public createdAt: Date;
|
public createdAt: Date;
|
||||||
|
|
||||||
@Index()
|
|
||||||
@Column('timestamp with time zone', {
|
|
||||||
nullable: true,
|
|
||||||
comment: 'The updated date of the Note.'
|
|
||||||
})
|
|
||||||
public updatedAt: Date | null;
|
|
||||||
|
|
||||||
@Index()
|
@Index()
|
||||||
@Column({
|
@Column({
|
||||||
...id(),
|
...id(),
|
||||||
|
|
|
@ -68,10 +68,6 @@ export async function updateQuestion(value: any) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await Notes.update(note.id, {
|
|
||||||
updatedAt: new Date(),
|
|
||||||
});
|
|
||||||
|
|
||||||
await Polls.update({ noteId: note.id }, {
|
await Polls.update({ noteId: note.id }, {
|
||||||
votes: poll.votes
|
votes: poll.votes
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
import { updateQuestion } from '../../../remote/activitypub/models/question';
|
|
||||||
import ms = require('ms');
|
|
||||||
import Logger from '../../logger';
|
|
||||||
import renderUpdate from '../../../remote/activitypub/renderer/update';
|
import renderUpdate from '../../../remote/activitypub/renderer/update';
|
||||||
import { renderActivity } from '../../../remote/activitypub/renderer';
|
import { renderActivity } from '../../../remote/activitypub/renderer';
|
||||||
import { deliver } from '../../../queue';
|
import { deliver } from '../../../queue';
|
||||||
|
@ -8,21 +5,6 @@ import renderNote from '../../../remote/activitypub/renderer/note';
|
||||||
import { Users, Notes, Followings } from '../../../models';
|
import { Users, Notes, Followings } from '../../../models';
|
||||||
import { Note } from '../../../models/entities/note';
|
import { Note } from '../../../models/entities/note';
|
||||||
|
|
||||||
const logger = new Logger('pollsUpdate');
|
|
||||||
|
|
||||||
export async function triggerUpdate(note: Note) {
|
|
||||||
if (!note.updatedAt || Date.now() - new Date(note.updatedAt).getTime() > ms('1min')) {
|
|
||||||
logger.info(`Updating ${note.id}`);
|
|
||||||
|
|
||||||
try {
|
|
||||||
const updated = await updateQuestion(note.uri);
|
|
||||||
logger.info(`Updated ${note.id} ${updated ? 'changed' : 'nochange'}`);
|
|
||||||
} catch (e) {
|
|
||||||
logger.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function deliverQuestionUpdate(noteId: Note['id']) {
|
export async function deliverQuestionUpdate(noteId: Note['id']) {
|
||||||
const note = await Notes.findOne(noteId);
|
const note = await Notes.findOne(noteId);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue