Skip to content

Commit

Permalink
revert: expiry fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AuHau committed Oct 18, 2023
1 parent cd9ee6c commit 5ac9765
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion codex/purchasing/states/submitted.nim
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ method run*(state: PurchaseSubmitted, machine: Machine): Future[?State] {.async.
await subscription.unsubscribe()

proc withTimeout(future: Future[void]) {.async.} =
let expiry = request.expiry.truncate(int64) + 1
let expiry = request.expiry.truncate(int64)
await future.withTimeout(clock, expiry)

try:
Expand Down
4 changes: 2 additions & 2 deletions tests/codex/testpurchasing.nim
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ asyncchecksuite "Purchasing":
let purchase = await purchasing.purchase(request)
check eventually market.requested.len > 0
let request = market.requested[0]
clock.set(request.expiry.truncate(int64)+1)
clock.set(request.expiry.truncate(int64))
expect PurchaseTimeout:
await purchase.wait()

test "checks that funds were withdrawn when purchase times out":
let purchase = await purchasing.purchase(request)
check eventually market.requested.len > 0
let request = market.requested[0]
clock.set(request.expiry.truncate(int64)+1)
clock.set(request.expiry.truncate(int64))
expect PurchaseTimeout:
await purchase.wait()
check market.withdrawn == @[request.id]
Expand Down

0 comments on commit 5ac9765

Please sign in to comment.