Skip to content

Commit

Permalink
Made Refresher less of a CPU hog
Browse files Browse the repository at this point in the history
  • Loading branch information
CRImier committed Jan 11, 2017
1 parent 9a99d5a commit 6f741bd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ui/refresher.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ def activate(self):
""" A method which is called when refresher needs to start operating. Is blocking, sets up input&output devices, renders the refresher, periodically calls the refresh function&refreshes the screen while self.in_foreground is True, while refresher callbacks are executed from the input device thread."""
logging.info("refresher {0} activated".format(self.name))
self.to_foreground()
sleep_time = 0.01
counter = 0
rts_ratio = self.refresh_interval/sleep_time
divisor = 2.0
sleep_time = self.refresh_interval/divisor
while self.in_background.isSet():
if self.in_foreground:
if counter == rts_ratio:
if counter == divisor:
counter = 0
if counter == 0:
self.refresh()
Expand Down

0 comments on commit 6f741bd

Please sign in to comment.