BIND004: polling-interval
Expression polls faster than the minimum interval
| Code | BIND004 |
| Name | polling-interval |
| Category | Bindings and expressions (BIND) |
| Default severity | warning |
| Enabled by default | yes |
| Fix available | no |
| ign-lint equivalent | PollingIntervalRule |
What it does
Section titled “What it does”Finds calls of polling expression functions in bindings and reports those
that poll faster than minimum-interval milliseconds:
now(n)with a literal0 < n < minimum-interval;now()without an argument, which polls every 1000 ms;runScript(script, n, ...)with a literal poll rate0 < n < minimum-interval.
A rate of 0 (or less) means "do not poll" and is fine. A rate that is not
a literal (now({view.custom.rate})) cannot be checked and is only
reported with strict.
Calls are found by parsing the expression, so snow(5) and 'now()'
inside a string literal are not calls of now. Every expression of a
binding is checked: expression and expression-structure bindings, tag
bindings in expression mode, query binding parameters, expression
transforms and map transform expressions, in views and session
properties.
Why is this bad?
Section titled “Why is this bad?”Every polling expression re-evaluates on its own timer in the gateway, for every open session. Fast polling of many bindings is a common cause of gateway load.
Example
Section titled “Example”dateFormat(now(), "HH:mm:ss")Use instead:
dateFormat(now(10000), "HH:mm:ss")Options
Section titled “Options”minimum-interval(default10000): the smallest allowed poll rate in milliseconds.
ign-lint
Section titled “ign-lint”Equivalent of PollingIntervalRule (kwarg minimum_interval), with the
same message in iglint ign-lint. Differences: ign-lint matches text, so it
also reports snow(5), now() inside string literals and now(-1), and
ignores a dynamic now({...}) when the same expression also has a literal
now(n); it reads indirect tag binding references (property paths, not
expressions) as if they could poll. It reports one finding per string,
iglint one per expression at the first offending call.
Option reference
Section titled “Option reference”Set in [rules.BIND004] of iglint.toml (or [tool.iglint.rules.BIND004] in pyproject.toml).
| Option | Type | Default | Description |
|---|---|---|---|
minimum-interval |
integer | 10000 |
Smallest allowed poll rate in milliseconds. |
ign-lint kwargs in a rule_config.json: minimum_interval -> minimum-interval.
Generated from the rule metadata by iglint generate-docs; iglint rule BIND004 prints the same page in the terminal. Source: docs/rules/BIND004.md.