Skip to content

Take a copy of rates obtained via download_octopus_rates so saving sessions don't repeatedly increment them#3611

Merged
springfall2008 merged 2 commits intospringfall2008:mainfrom
AndrewColes:main
Mar 21, 2026
Merged

Take a copy of rates obtained via download_octopus_rates so saving sessions don't repeatedly increment them#3611
springfall2008 merged 2 commits intospringfall2008:mainfrom
AndrewColes:main

Conversation

@AndrewColes
Copy link
Contributor

When using rates_import_octopus_url/rates_export_octopus_url:

  • download_octopus_rates fetches the current cached import/export rates
  • load_saving_slot increments the rates as stored in the cache at the relevant times
  • hence these increases accumulate, and reset only when the cache is deemed stale
  • repeat until the saving session is over

Solution -- take a copy of the cached import/export rates, so saving sessions affect only a local copy of the rates rather than the cached rates.

(Happy to submit an issue with a log file evidencing the bug, if that's your preferred workflow.)

AndrewColes and others added 2 commits March 20, 2026 21:58
…ssions don't repeatedly increment them

When using rates_import_octopus_url/rates_export_octopus_url:

- ```download_octopus_rates``` fetches the current cached import/export rates
- ```load_saving_slot``` increments the rates *as stored in the cache* at the relevant times
- these increases accumulate, and reset only when the cache is deemed stale
- repeat until the saving session is over

Solution -- take a copy of the cached import/export rates, so saving sessions affect only a local copy of the rates rather than the cached rates.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an Octopus URL rate-cache mutation bug where applying saving sessions would repeatedly increment the cached import/export rates across refresh cycles, causing the effective rates to drift upward until the cache expires.

Changes:

  • Make fetch_sensor_data() take a local copy of import rates returned from download_octopus_rates() so saving-session adjustments don’t mutate the URL cache.
  • Make fetch_sensor_data() take a local copy of export rates returned from download_octopus_rates() for the same reason.

@springfall2008 springfall2008 merged commit 510cccc into springfall2008:main Mar 21, 2026
5 checks passed
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.

3 participants