|
|
|
@ -283,19 +283,12 @@ module.exports = function(state) {
|
|
|
|
|
return Promise.try(() => {
|
|
|
|
|
return getTaskResult(tx, task, id);
|
|
|
|
|
}).then((taskResult) => {
|
|
|
|
|
let sharedFields = {
|
|
|
|
|
isInvalidated: false,
|
|
|
|
|
updatedAt: new Date()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (taskResult != null) {
|
|
|
|
|
return taskResult.$query(tx).patch({
|
|
|
|
|
... sharedFields,
|
|
|
|
|
metadata: update(taskResult.metadata),
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
return db.TaskResult.query(tx).insert({
|
|
|
|
|
... sharedFields,
|
|
|
|
|
task: task.name,
|
|
|
|
|
itemId: id,
|
|
|
|
|
metadata: update({})
|
|
|
|
@ -333,7 +326,9 @@ module.exports = function(state) {
|
|
|
|
|
}).then((taskResult) => {
|
|
|
|
|
let sharedFields = {
|
|
|
|
|
isSuccessful: isSuccessful,
|
|
|
|
|
isInvalidated: false,
|
|
|
|
|
taskVersion: task.version,
|
|
|
|
|
updatedAt: new Date(),
|
|
|
|
|
expiresAt: (task.ttl != null)
|
|
|
|
|
? addMilliseconds(new Date(), task.ttl)
|
|
|
|
|
: undefined
|
|
|
|
|