Open
Conversation
Store the current daySamples value in a new 'variables' table. On startup, if the config value differs from the stored value: - If shrinking, prune day slots outside the new window - Shift chanops_daily.day values so currentDay maps to the same data - Update the stored value This prevents score data from becoming misaligned when the daysamples config parameter is changed between restarts. Migration 003 creates the variables table and seeds it with the default value of 14.
…mples - Replace UPDATE with UPSERT (INSERT ... ON CONFLICT DO UPDATE) when persisting the new daysamples value, preventing a silent noop that would cause the day-slot shift to be re-applied on every restart. - Use escapeSQLChars() on the daysamples value embedded in the SQL string literal, consistent with the rest of the codebase. - Treat daysamples < 1 as a fatal config error (exit on startup) instead of silently falling back to 14, to prevent a zero-modulus crash if the value somehow reaches the arithmetic in migrateDaySamples.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
openchanfix: auto-migrate chanops_daily when daySamples changes
I also applied changes ( commit f47da22) based on @Ratler's comments.