Remove invalidation flag and update last-update timestamp on task completion, not on metadata update

master
Sven Slootweg 2 years ago
parent 48e9f8372b
commit 7c60c4fa6b

@ -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

Loading…
Cancel
Save