Skip to content

Allow fractional connection durations - #1001

Open
attilaolah wants to merge 1 commit into
nats-io:mainfrom
attilaolah:issue-1000-fix-duration-annotations
Open

Allow fractional connection durations#1001
attilaolah wants to merge 1 commit into
nats-io:mainfrom
attilaolah:issue-1000-fix-duration-annotations

Conversation

@attilaolah

Copy link
Copy Markdown

Closes #1000.

Updates the public Client.connect() annotations for connect_timeout and reconnect_time_wait to float, matching their use as asyncio durations. Integer callers remain supported.

Validation:

  • uv run ruff format --check nats/src/nats/aio/client.py
  • uv run ruff check nats/src/nats/aio/client.py
  • uv run ty check (fails with 167 existing diagnostics outside nats/)
  • uv run pytest nats/tests not run because nats-server is not installed

Correct the public duration annotations to match asyncio's fractional-second support.

Assisted-by: OpenCode:gpt-5.6-terra ruff ty
Signed-off-by: Attila Oláh <attila@dorn.haus>
@attilaolah

Copy link
Copy Markdown
Author

It would be even nicer to accept timedelta | float here, and take the .total_seconds() if a timedelta was passed. But that is already a runtime change.

This PR is trying to keep it minimal and only make a typing correction, no runtime change is intended.

@caspervonb
caspervonb self-requested a review August 17, 2026 08:44
@caspervonb caspervonb changed the title fix: allow fractional connection durations Allow fractional connection durations Aug 17, 2026
@caspervonb caspervonb added the nats-legacy Legacy asyncio NATS client label Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nats-legacy Legacy asyncio NATS client

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Annotate connect timeout and reconnect wait as float

2 participants