summaryrefslogtreecommitdiff
path: root/src/queue/index.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2019-02-05 19:50:14 +0900
committerGitHub <noreply@github.com>2019-02-05 19:50:14 +0900
commit5db5bbd1cd25f83640d4dd01de14e7774d9370db (patch)
tree701c27744ca0e4d6e16d5f2fb568481c1bf4baf0 /src/queue/index.ts
parentAdd ffmpeg package for the runner container (#4145) (diff)
downloadsharkey-5db5bbd1cd25f83640d4dd01de14e7774d9370db.tar.gz
sharkey-5db5bbd1cd25f83640d4dd01de14e7774d9370db.tar.bz2
sharkey-5db5bbd1cd25f83640d4dd01de14e7774d9370db.zip
自分の投稿情報をエクスポートできるように (#4144)
* wip * 正しいJSONを生成するように * データを整形
Diffstat (limited to 'src/queue/index.ts')
-rw-r--r--src/queue/index.ts18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/queue/index.ts b/src/queue/index.ts
index 65c52d864c..cf8af17a48 100644
--- a/src/queue/index.ts
+++ b/src/queue/index.ts
@@ -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);
}
}