Async Await Support via AsyncJob
This patch was authored by @jdmcd and released by @0xTim.
Adds AsyncJob
which allows you to specify a job that has async body implementations:
struct MyJobPayload: Content {
let name: String
}
struct MyAsyncJob: AsyncJob {
func dequeue(context: QueueContext, payload: MyJobPayload) async throws {
print(payload.name)
}
func error(context: QueueContext, error: Error, payload: MyJobPayload) async throws {
print(error)
}
}
// In configure.swift
app.queues.add(MyAsyncJob())