• 7.0.1 8cd6e066e8

    7.0.1 Pre-release

    Dejan released this 2026-04-17 15:49:16 +00:00 | 38 commits to main since this release

    Bugs fixed

    • startAlarmWriter — was hardcoding 1000ms ticker and 32 batch size; now correctly uses cfg.DB.FlushIntervalMs and cfg.DB.BatchSize like startDBWriter does

    • alarmCh queue — was hardcoded 512; now uses new cfg.DB.AlarmQueueSize field (default 512, but configurable)

    • buf := make([]byte, 8) — moved outside the inner PLC poll loop (was heap-allocating every 500ms)

    Design improvements

    • PressConfig.MAX_TONNAGE → renamed to MaxTonnage (idiomatic Go); YAML tag stays MAX_TONNAGE so existing config files need no changes

    • classifyForceDirection + classifyImbalanceDirection — merged into one classifyDirection(delta, oldCount, newCount, stableThreshold, posLabel, negLabel) function

    • Graceful shutdown — signal.NotifyContext with SIGINT/SIGTERM; all four goroutines accept context.Context, drain their queues on shutdown, HTTP server does a clean srv.Shutdown()

    • normalizeConfig — replaced ~100 lines of repetitive if-chains with setIfZeroF / setIfZeroI / setIfEmpty helpers

    Polish

    • version = "0.7.1" constant at package level

    • cachedUI — HTML template rendered once at startup, served as []byte instead of re-executing the template on every request

    • maybeLogPLCDisconnected — simplified the double-condition check into a single guard clause

    Downloads