-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* beta 2 * beta 2 updates * update schedule builder * regen linuxmain * fix ci
- Loading branch information
1 parent
e7b958f
commit 6999d96
Showing
36 changed files
with
824 additions
and
3,684 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,20 @@ | ||
@_exported import struct Foundation.Date | ||
@_exported import struct Logging.Logger | ||
@_exported import class NIO.EventLoopFuture | ||
@_exported import struct NIO.EventLoopPromise | ||
@_exported import protocol NIO.EventLoop | ||
@_exported import struct NIO.TimeAmount | ||
|
||
import class NIO.RepeatedTask | ||
|
||
extension RepeatedTask { | ||
func syncCancel(on eventLoop: EventLoop) { | ||
do { | ||
let promise = eventLoop.makePromise(of: Void.self) | ||
self.cancel(promise: promise) | ||
try promise.futureResult.wait() | ||
} catch { | ||
print("failed cancelling repeated task \(error)") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
import Foundation | ||
import Vapor | ||
|
||
/// A simple wrapper to hold job context and services. | ||
public struct JobContext { | ||
/// Storage for the wrapper. | ||
public var userInfo: [AnyHashable: Any] | ||
|
||
public let queueName: JobsQueueName | ||
public let configuration: JobsConfiguration | ||
public let logger: Logger | ||
public let eventLoop: EventLoop | ||
|
||
/// Creates an empty `JobContext` | ||
public init(userInfo: [AnyHashable: Any] = [:], on eventLoop: EventLoop) { | ||
public init( | ||
queueName: JobsQueueName, | ||
configuration: JobsConfiguration, | ||
logger: Logger, | ||
on eventLoop: EventLoop | ||
) { | ||
self.queueName = queueName | ||
self.configuration = configuration | ||
self.logger = logger | ||
self.eventLoop = eventLoop | ||
self.userInfo = [:] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/// Holds information about the Job that is to be encoded to the persistence store. | ||
public struct JobData: Codable { | ||
/// The job data to be encoded. | ||
public let payload: [UInt8] | ||
|
||
/// The maxRetryCount for the `Job`. | ||
public let maxRetryCount: Int | ||
|
||
/// A date to execute this job after | ||
public let delayUntil: Date? | ||
|
||
/// The date this job was queued | ||
public let queuedAt: Date | ||
|
||
/// The name of the `Job` | ||
public let jobName: String | ||
|
||
/// Creates a new `JobStorage` holding object | ||
public init( | ||
payload: [UInt8], | ||
maxRetryCount: Int, | ||
jobName: String, | ||
delayUntil: Date?, | ||
queuedAt: Date | ||
) { | ||
self.payload = payload | ||
self.maxRetryCount = maxRetryCount | ||
self.jobName = jobName | ||
self.delayUntil = delayUntil | ||
self.queuedAt = queuedAt | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import struct Foundation.UUID | ||
|
||
public struct JobIdentifier: Hashable, Equatable { | ||
public let string: String | ||
|
||
public init(string: String) { | ||
self.string = string | ||
} | ||
|
||
public init() { | ||
self.init(string: UUID().uuidString) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.