Skip to content

Influx: buffer writes while the database is unavailable - #406

Closed
andig wants to merge 1 commit into
masterfrom
feat/influx-retry
Closed

andig wants to merge 1 commit into
masterfrom
feat/influx-retry

Conversation

@andig

@andig andig commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

fixes #242

Adds --influx-buffer (config key influx.buffer), a duration such as 1h. While InfluxDB is unreachable, readings are kept in memory and retried for that long instead of being dropped after the client default of 5 retries within 3 minutes.

The influxdb-client-go write API already batches points once per flush interval and keeps a retry queue, so this only configures it: retries become unbounded and the retry queue is sized to hold the batches produced during the buffer duration (the queue counts batches, RetryBufferLimit / BatchSize). Once full, the oldest batch is discarded, so memory stays bounded by the actual data rate times the buffer duration. Without the option nothing changes.

🤖 Generated with Claude Code

fixes #242

Adds --influx-buffer (config: influx.buffer), a duration for which
readings are kept in memory and retried when InfluxDB cannot be reached.
The client already batches writes and keeps a retry queue; with a buffer
set, retries become unbounded and the queue is sized to hold the batches
of that duration, dropping the oldest once full. Without the option the
client default of 5 retries within 3 minutes stays in effect.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@andig andig added the enhancement New feature or request label Sep 30, 2026
@andig

andig commented Sep 30, 2026

Copy link
Copy Markdown
Contributor Author

Not gonna merge. A parameter is too ugly to do.

@andig andig closed this Sep 30, 2026
@andig andig mentioned this pull request Sep 30, 2026
isarrider added a commit to isarrider/mbmd that referenced this pull request Nov 2, 2026
@isarrider

Copy link
Copy Markdown
Contributor

Added tests...
#412

@isarrider

Copy link
Copy Markdown
Contributor

Continued in #413: your commit from here, unchanged and rebased onto current master, plus tests (buffer options, an outage with and without buffer) and a clearer description of the default. Thanks for the implementation!

isarrider pushed a commit to isarrider/mbmd that referenced this pull request Nov 16, 2026
The influx row now points at the open upstream PR volkszaehler#413 and notes that
andig rejected a parameter for this in volkszaehler#406. A new table lists every
upstream PR from this fork, what it was and where closed ones continued.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KmuA1dQ8QTTW8pao9KcJS2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cache writings

2 participants