Skip to content

Commit

Permalink
Implemented push to support delayed jobs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrewangeta committed Jan 9, 2021
1 parent 1ccc419 commit 8d98680
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Sources/QueuesMongoDriver/Queues.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,14 @@ 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: ["queue": "\(context.queueName.string)",
"status": "processing"],
update: ["$set": ["status": MongoJobStatus.ready.rawValue]])
.execute()
.transform(to: ())
}
}

Expand Down

0 comments on commit 8d98680

Please sign in to comment.