Skip to content

Commit

Permalink
Merge pull request #4 from vapor-community/push-update
Browse files Browse the repository at this point in the history
Implemented push to support delayed jobs.
  • Loading branch information
Andrewangeta authored Jan 9, 2021
2 parents 1ccc419 + e76fb82 commit 5b4c906
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Sources/QueuesMongoDriver/Queues.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,15 @@ class MongoQueue: Queue {
}
}

// Mark jobs that can't be finished as ready.
func push(_ id: JobIdentifier) -> EventLoopFuture<Void> {
context.eventLoop.future()
mongodb["vapor_queue"]
.findAndModify(where: ["jobid": id.string,
"queue": "\(context.queueName.string)",
"status": "processing"],
update: ["$set": ["status": MongoJobStatus.ready.rawValue]])
.execute()
.transform(to: ())
}
}

Expand Down

0 comments on commit 5b4c906

Please sign in to comment.