Skip to content

Commit

Permalink
Make cancelation test less flaky
Browse files Browse the repository at this point in the history
Hopefully extending the sleep time of the predictions to be canceled
ensures that these all get canceled correctly.
  • Loading branch information
nickstenning committed Aug 23, 2024
1 parent b76869f commit 21ad75c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python/tests/server/test_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,11 @@ def test_cancel_multiple_predictions(worker):
"""
dones: list[Done] = []
for _ in range(5):
fut = worker.predict({"sleep": 0.1})
time.sleep(0.01)
fut = worker.predict({"sleep": 1})
time.sleep(0.1)
worker.cancel()
dones.append(fut.result())
assert all(d.canceled for d in dones)
assert dones == [Done(canceled=True)] * 5

assert not worker.predict({"sleep": 0}).result().canceled

Expand Down

0 comments on commit 21ad75c

Please sign in to comment.