Skip to content

influx: use upstream buffering (#406) and add tests - #9

Merged
isarrider merged 2 commits into
masterfrom
feat/influx-buffer-upstream
Nov 2, 2026
Merged

isarrider merged 2 commits into
masterfrom
feat/influx-buffer-upstream

Conversation

@isarrider

Copy link
Copy Markdown
Owner

Switches the fork's influx write buffering to andig's implementation from volkszaehler#406 and adds tests for it.

Why: volkszaehler#406 uses the same --influx-buffer flag and influx.buffer key as our volkszaehler#408 but with different semantics. Taking upstream's version now means configs behave the same once volkszaehler#406 is merged and the fork syncs.

Behaviour change: the default is now 0, which keeps the InfluxDB client default (5 retries within 3 minutes, about 10s of data). Before, the fork defaulted to 1h. Set buffer: 1h explicitly to keep buffering.

Tests (server/influx_test.go, no changes to volkszaehler#406's code):

  • TestInfluxBufferOptions: retry queue size (in batches), retry count and retry time for 0, 500ms, 10m and 1h
  • TestInfluxOutage: 20s outage against a fake InfluxDB, every point arrives with a 1h buffer (~25s)
  • TestInfluxOutageDefault: the same outage loses data with the default, which shows the outage test is meaningful (~80s)

The outage tests are skipped with -short. go vet and go test ./... pass.

The test commit applies on its own and can be offered to volkszaehler#406.


Generated by Claude Code

isarrider and others added 2 commits November 2, 2026 19:30
Replace the fork's influx buffering with andig's implementation from
volkszaehler#406 so the fork matches upstream's semantics for
`influx.buffer`:

- default 0 keeps the client default (5 retries within 3 minutes)
- buffer > 0 retries indefinitely and keeps the batches of the last
  `buffer` duration

Note: the fork previously defaulted to 1h. Set `buffer: 1h` explicitly
to keep buffering.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XzyNHxELw6PasHKku3kreU
- TestInfluxBufferOptions checks the retry queue size, retry count and
  retry time derived from the buffer duration, including the client
  defaults for 0 and the one-batch minimum
- TestInfluxOutage simulates a 20s database outage against a fake
  server and checks that every point is delivered with a 1h buffer
- TestInfluxOutageDefault checks that the same outage loses data with
  the client defaults, so the outage test is meaningful

The outage tests are skipped with -short.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XzyNHxELw6PasHKku3kreU
@isarrider
isarrider merged commit b4d78cf into master Nov 2, 2026
3 checks passed
@isarrider
isarrider deleted the feat/influx-buffer-upstream branch November 2, 2026 18:55
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.

1 participant