Skip to content

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

Open
gijzelaerr wants to merge 1 commit into
masterfrom
feat/628-request-rate-limiter
Open

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

Conversation

@gijzelaerr

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.

Validation

  • uv run --frozen pre-commit run --all-files
  • uv run --frozen pytest -q (1649 passed, 82 skipped)
  • uv build

Fixes #628

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