Skip to content

Commit 9c0c54b

Browse files
committed
Fix csot reset
1 parent 907ffbc commit 9c0c54b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pymongo/_csot.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ def remaining() -> Optional[float]:
6767

6868
@contextlib.contextmanager
6969
def reset() -> Generator:
70-
deadline_token = DEADLINE.set(DEADLINE.get() + get_timeout()) # type: ignore[operator]
70+
timeout = get_timeout()
71+
if timeout is None:
72+
deadline_token = DEADLINE.set(DEADLINE.get())
73+
else:
74+
deadline_token = DEADLINE.set(DEADLINE.get() + timeout) # type: ignore[operator]
7175
yield
7276
DEADLINE.reset(deadline_token)
7377

0 commit comments

Comments
 (0)