Skip to content

Commit

Permalink
fix: queue timeout precision (#10)
Browse files Browse the repository at this point in the history
* fix: queue timeout precision

* fix: remove print
  • Loading branch information
drochetti authored Feb 13, 2024
1 parent 2d28371 commit 172f1fb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/FalClient/FalClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public struct FalClient: Client {
onQueueUpdate: OnQueueUpdate?
) async throws -> Payload {
let requestId = try await queue.submit(app, path: path, input: input)
let start = Int(Date().timeIntervalSince1970 * 1000)
var elapsed = 0
let start = Int64(Date().timeIntervalSince1970 * 1000)
var elapsed: Int64 = 0
var isCompleted = false
while elapsed < timeout.milliseconds {
let update = try await queue.status(app, of: requestId, includeLogs: includeLogs)
Expand All @@ -67,7 +67,7 @@ public struct FalClient: Client {
break
}
try await Task.sleep(nanoseconds: UInt64(Int(pollInterval.milliseconds * 1_000_000)))
elapsed += Int(Date().timeIntervalSince1970 * 1000) - start
elapsed = Int64(Date().timeIntervalSince1970 * 1000) - start
}
if !isCompleted {
throw FalError.queueTimeout
Expand Down

0 comments on commit 172f1fb

Please sign in to comment.