Skip to content
Snippets Groups Projects
Unverified Commit d7df75ae authored by syuilo's avatar syuilo
Browse files

Clean up

parent 11c30ecc
No related branches found
No related tags found
No related merge requests found
......@@ -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(),
......
......@@ -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
});
......
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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment