Skip to content

Commit

Permalink
Wrap initializer in sendable closure
Browse files Browse the repository at this point in the history
  • Loading branch information
ncooke3 committed Oct 28, 2024
1 parent 36d81b5 commit 62e62b0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public final class HeartbeatController: Sendable {
/// Public initializer.
/// - Parameter id: The `id` to associate this controller's heartbeat storage with.
public convenience init(id: String) {
self.init(id: id, dateProvider: Date.init)
self.init(id: id, dateProvider: { Date() })
}

/// Convenience initializer. Mirrors the semantics of the public initializer with the added
Expand All @@ -61,7 +61,7 @@ public final class HeartbeatController: Sendable {
/// - storage: A heartbeat storage container.
/// - dateProvider: A date provider. Defaults to providing the current date.
init(storage: HeartbeatStorageProtocol,
dateProvider: @escaping @Sendable () -> Date = Date.init) {
dateProvider: @escaping @Sendable () -> Date = { Date() }) {
self.storage = storage
self.dateProvider = { Self.dateStandardizer.standardize(dateProvider()) }
}
Expand Down

0 comments on commit 62e62b0

Please sign in to comment.