This commit is contained in:
syuilo 2019-04-12 01:01:25 +09:00
parent 11c30eccb3
commit d7df75ae6c
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
3 changed files with 0 additions and 29 deletions

View file

@ -15,13 +15,6 @@ export class Note {
})
public createdAt: Date;
@Index()
@Column('timestamp with time zone', {
nullable: true,
comment: 'The updated date of the Note.'
})
public updatedAt: Date | null;
@Index()
@Column({
...id(),

View file

@ -68,10 +68,6 @@ export async function updateQuestion(value: any) {
}
}
await Notes.update(note.id, {
updatedAt: new Date(),
});
await Polls.update({ noteId: note.id }, {
votes: poll.votes
});

View file

@ -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 { renderActivity } from '../../../remote/activitypub/renderer';
import { deliver } from '../../../queue';
@ -8,21 +5,6 @@ import renderNote from '../../../remote/activitypub/renderer/note';
import { Users, Notes, Followings } from '../../../models';
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']) {
const note = await Notes.findOne(noteId);