自分の投稿情報をエクスポートできるように (#4144)

* wip

* 正しいJSONを生成するように

* データを整形
This commit is contained in:
syuilo
2019-02-05 19:50:14 +09:00
committed by GitHub
parent ba7e05837c
commit 5db5bbd1cd
8 changed files with 188 additions and 9 deletions

View File

@ -1,9 +1,9 @@
import * as Queue from 'bee-queue';
import config from '../config';
import http from './processors/http';
import { ILocalUser } from '../models/user';
import Logger from '../misc/logger';
import { program } from '../argv';
import handler from './processors';
const enableQueue = config.redis != null && !program.disableQueue;
@ -36,7 +36,7 @@ export function createHttpJob(data: any) {
.backoff('exponential', 16384) // 16s
.save();
} else {
return http({ data }, () => {});
return handler({ data }, () => {});
}
}
@ -51,10 +51,18 @@ export function deliver(user: ILocalUser, content: any, to: any) {
});
}
export const queueLogger = new Logger('queue');
export function createExportNotesJob(user: ILocalUser) {
if (!enableQueue) throw 'queue disabled';
return queue.createJob({
type: 'exportNotes',
user: user
})
.save();
}
export default function() {
if (enableQueue) {
queue.process(128, http);
queue.process(128, handler);
}
}