Skip to content

Commit 864fe2c

Browse files
committed
mintUpdate.py: Fix auto-refresh loop race condition.
The refresh() function is an _idle function, and being called from the auto-refresh thread. Because of this, the thread ends up looping before the 'refresh-last-run' value can be updated, causing another refresh to occur 1 minute later. This happens for every periodic refresh. ref: #1017
1 parent f0cd05e commit 864fe2c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

usr/lib/linuxmint/mintUpdate/mintUpdate.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,6 +1159,11 @@ def start_auto_refresh(self):
11591159
if self.hidden:
11601160
self.logger.write(f"Update Manager is in tray mode; performing {refresh_type} refresh")
11611161
self.refresh(True)
1162+
# FIXME: self.refresh() is an _idle function, and we're on a thread - we will continue
1163+
# and loop before self.refreshing is set. Force a brief dwell to allow the refresh() call
1164+
# to get ahead of us and set self.refreshing and update 'refresh-last-run', otherwise we'll
1165+
# get a double-refresh 1 minute apart every time.
1166+
time.sleep(0.5)
11621167
while self.refreshing:
11631168
time.sleep(5)
11641169
else:

0 commit comments

Comments
 (0)