Skip to content

fix incorrect back-off factor update in dash.py#3

Open
zjx20 wants to merge 1 commit intoImAleeexx:masterfrom
zjx20:patch-1
Open

fix incorrect back-off factor update in dash.py#3
zjx20 wants to merge 1 commit intoImAleeexx:masterfrom
zjx20:patch-1

Conversation

@zjx20
Copy link
Copy Markdown

@zjx20 zjx20 commented Jul 28, 2024

No description provided.

@ImAleeexx
Copy link
Copy Markdown
Owner

Why should the back off factor be capped at 10 ?

@zjx20
Copy link
Copy Markdown
Author

zjx20 commented Jul 29, 2024

I should have explained this. Please notice that the back_off_factor variable isn't the actual sleep time, it's a factor.

Let's simply the logic.

back_off_factor = 1
while not closed:
    refresh_wait = 5 # although it could be something else, let's assume that it is 5
    with self.sleeper(refresh_wait * back_off_factor):
        ...
        if not self.reload():
            back_off_factor = max(back_off_factor * 1.3, 10.0)
        else:
            back_off_factor = 1

Suppose self.reload() returns False 5 times in a row, and the values of back_off_factor are 1, 10, 13, 16.9, 21.97, 28.561. The actual sleep times refresh_wait * back_off_factor are 5s, 50s, 65s, 84.5s, 109.85s, 142.805s.
But if we change the max() to min(), the back_off_factor sequence is 1, 1.3, 1.69, 2.197, 2.8561, 3.71293. And the actual sleep time sequence is 5s, 6.5s, 8.45s, 10.985s, 14.2805s, 18.56465.

I believe this is a logical error and min() should be the correct one, because a 10 times longer sleep time for the first failure makes no sense.

Why should the back off factor be capped at 10 ?

Since refresh_wait is the suggested refresh interval, 10 times refresh_wait should be large enough for backing-off.

@tom00x3h3
Copy link
Copy Markdown

tom00x3h3 commented Feb 6, 2025

Have you noticed a memory leak after a few hours?
My RAM gets overloaded after a few hours.
The problem occurs when opening dash + key

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