Skip to content

Commit

Permalink
[http] Fix wrong cache calculation (#526)
Browse files Browse the repository at this point in the history
Reported on the forum

Signed-off-by: Jan N. Klug <[email protected]>
(cherry picked from commit bc986d7)
Signed-off-by: Jan N. Klug <[email protected]>
  • Loading branch information
J-N-K committed Oct 9, 2023
1 parent 3140ab2 commit b417b78
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@ public void initialize() {
}
rateLimitedHttpClient.setDelay(config.delay);

int channelCount = thing.getChannels().size();
if (channelCount * config.delay > config.refresh * 1000) {
int urlHandlerCount = urlHandlers.size();
if (urlHandlerCount * config.delay > config.refresh * 1000) {
// this should prevent the rate limit queue from filling up
config.refresh = (channelCount * config.delay) / 1000 + 1;
config.refresh = (urlHandlerCount * config.delay) / 1000 + 1;
logger.warn(
"{} channels in thing {} with a delay of {} incompatible with the configured refresh time. Refresh-Time increased to the minimum of {}",
channelCount, thing.getUID(), config.delay, config.refresh);
urlHandlerCount, thing.getUID(), config.delay, config.refresh);
}

// remove empty headers
Expand Down

0 comments on commit b417b78

Please sign in to comment.