PERF002: fast-query-polling
Query, tag history or HTTP binding polls faster than minimum-interval
| Code | PERF002 |
| Name | fast-query-polling |
| Category | Performance (PERF) |
| Default severity | warning |
| Enabled by default | yes |
| Fix available | no |
| ign-lint equivalent | none |
What it does
Section titled “What it does”Reports query, tag history and HTTP bindings with polling enabled whose
literal polling rate is shorter than minimum-interval. The binding's
polling.rate is in seconds; minimum-interval is in milliseconds, like
BIND004's. A rate of 0 (no polling) and rates given as expressions are
not reported.
Why is this bad?
Section titled “Why is this bad?”Each poll runs the query (or history request, or HTTP call) again, for every session that shows the view. A one-second poll on a view open on twenty screens is twenty queries a second against the database, mostly returning the same rows.
Example
Section titled “Example”"binding": {"type": "query", "config": {"queryPath": "Machines/Status", "polling": {"enabled": true, "rate": "1"}}}Use instead:
"binding": {"type": "query", "config": {"queryPath": "Machines/Status", "polling": {"enabled": true, "rate": "30"}}}Options
Section titled “Options”minimum-interval(default10000): the shortest allowed polling interval in milliseconds.
Option reference
Section titled “Option reference”Set in [rules.PERF002] of iglint.toml (or [tool.iglint.rules.PERF002] in pyproject.toml).
| Option | Type | Default | Description |
|---|---|---|---|
minimum-interval |
integer | 10000 |
Shortest allowed polling interval in milliseconds. |
Generated from the rule metadata by iglint generate-docs; iglint rule PERF002 prints the same page in the terminal. Source: docs/rules/PERF002.md.