|
|
|
@ -11,6 +11,8 @@ const buffer = require("@promistream/buffer");
|
|
|
|
|
const pipe = require("@promistream/pipe");
|
|
|
|
|
|
|
|
|
|
const createMutationAPIWrapper = require("./mutation-api/wrapper");
|
|
|
|
|
const logStatus = require("./log-status");
|
|
|
|
|
const chalk = require("chalk");
|
|
|
|
|
|
|
|
|
|
// FIXME: Revert inlining of task_states once switched to PostgreSQL 12+, which can do this automatically using NOT MATERIALIZED
|
|
|
|
|
let query = `
|
|
|
|
@ -128,7 +130,7 @@ module.exports = function (state) {
|
|
|
|
|
buffer(),
|
|
|
|
|
globalRateLimiter,
|
|
|
|
|
processTaskSafely(task, (item, tx) => {
|
|
|
|
|
console.log(`[${task}][started] ${item.id}`);
|
|
|
|
|
logStatus(task, chalk.bold.cyan, "started", item.id);
|
|
|
|
|
|
|
|
|
|
let context = { tx, item, task, taskVersion };
|
|
|
|
|
|
|
|
|
@ -171,7 +173,7 @@ module.exports = function (state) {
|
|
|
|
|
expires_at: dateFns.add(new Date(), { seconds: ttlInSeconds })
|
|
|
|
|
});
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.warn(`[${task}][failed] ${item.id}`, error);
|
|
|
|
|
logStatus(task, chalk.bold.red, "failed", item.id);
|
|
|
|
|
|
|
|
|
|
return Promise.try(() => {
|
|
|
|
|
// Task failed -- note, cannot use tx here because it has failed
|
|
|
|
|