Skip to content

Commit

Permalink
PriceChart: remove update debouncing
Browse files Browse the repository at this point in the history
- On chart parameter changes, we want immediate updates. It also doesn't hurt, if a
  scheduled update soon after then runs into the rate limit, as we already at least
  updated the chart on parameter change.
- On non chart parameter changes, i.e. regular scheduled updates, there was no de-
  bouncing previously either, as a request was only skipped if there was an update
  scheduled soon after.
  • Loading branch information
danimoh committed Apr 23, 2024
1 parent 6f930c9 commit 563a6e4
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/components/PriceChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,6 @@ export default defineComponent({
}
const TWO_MINUTES = 2 * 60 * 1000;
// Same algorithm as in main.ts where the exchange rate update is queued
const nextUpdateIn = Math.max(0, Math.min(lastUpdate + TWO_MINUTES - Date.now(), TWO_MINUTES));
// If the exchange rate will be updated in less than 5 seconds anyway, do not query historic rates yet
if (nextUpdateIn < 5e3) return;
const timeRangeHours = {
[TimeRange['24h']]: 24,
[TimeRange['7d']]: 7 * 24,
Expand Down

0 comments on commit 563a6e4

Please sign in to comment.