Skip to content

feat(client): add request rate limiting - #823

Open
gijzelaerr wants to merge 2 commits into
masterfrom
feat/628-request-rate-limiter
Open

feat(client): add request rate limiting#823
gijzelaerr wants to merge 2 commits into
masterfrom
feat/628-request-rate-limiter

Conversation

@gijzelaerr

@gijzelaerr gijzelaerr commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • add opt-in per-client request limiting at the outbound S7 PDU boundary
  • support evenly spaced fixed-rate and burst-capable token-bucket algorithms
  • support blocking, immediate rejection, and explicitly marked dropped-request behavior
  • cover both synchronous and asynchronous clients
  • document configuration and add deterministic limiter tests

A multi-variable PDU counts as one request, while chunked and multi-packet operations count each actual PDU. Model-specific defaults are intentionally not inferred: the limiter is disabled by default and users choose a rate appropriate for their PLC and workload.

Silent drops are unsafe because the client would wait for a response to a request that was never sent. Both raise and drop therefore surface S7RateLimitError; the latter sets dropped=True.

The branch now includes current master through a merge commit.

Validation

  • uv run --frozen pre-commit run --all-files
  • uv run --frozen --extra test --extra s7commplus pytest -q (1783 passed, 82 skipped)
  • focused limiter/client tests (162 passed, 1 skipped)
  • uv build --no-sources

Fixes #628

@gijzelaerr
gijzelaerr requested a review from nikteliy September 1, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Request rate limiting to protect PLC resources

1 participant