From c5df8bbda077fefe5a87b94aead9c4ec7310ded1 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 12 Apr 2019 01:01:25 +0900 Subject: [PATCH] Clean up --- src/models/entities/note.ts | 7 ------- src/remote/activitypub/models/question.ts | 4 ---- src/services/note/polls/update.ts | 18 ------------------ 3 files changed, 29 deletions(-) diff --git a/src/models/entities/note.ts b/src/models/entities/note.ts index 253d157b8..176fc626b 100644 --- a/src/models/entities/note.ts +++ b/src/models/entities/note.ts @@ -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(), diff --git a/src/remote/activitypub/models/question.ts b/src/remote/activitypub/models/question.ts index 68f0cb359..2ff8e21ab 100644 --- a/src/remote/activitypub/models/question.ts +++ b/src/remote/activitypub/models/question.ts @@ -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 }); diff --git a/src/services/note/polls/update.ts b/src/services/note/polls/update.ts index ff8e8d59e..beb35cc27 100644 --- a/src/services/note/polls/update.ts +++ b/src/services/note/polls/update.ts @@ -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);