#5449 NORM Never A: downloads update the datastore too often

Zarro Boogs per Child bugtracker at laptop.org
Tue Dec 11 10:36:08 EST 2007


#5449: downloads update the datastore too often
------------------------------+---------------------------------------------
  Reporter:  tomeu            |       Owner:  tomeu         
      Type:  defect           |      Status:  new           
  Priority:  normal           |   Milestone:  Never Assigned
 Component:  browse-activity  |     Version:                
Resolution:                   |    Keywords:  Update.1?     
  Verified:  0                |  
------------------------------+---------------------------------------------

Comment(by tomeu):

 Or well, perhaps it's better 5s/10%.

 Patch:

 {{{
 diff --git a/downloadmanager.py b/downloadmanager.py
 index 07374f1..174b05f 100644
 --- a/downloadmanager.py
 +++ b/downloadmanager.py
 @@ -48,6 +48,9 @@ DS_DBUS_SERVICE = 'org.laptop.sugar.DataStore'
  DS_DBUS_INTERFACE = 'org.laptop.sugar.DataStore'
  DS_DBUS_PATH = '/org/laptop/sugar/DataStore'

 +_MIN_TIME_UPDATE = 5        # In seconds
 +_MIN_PERCENT_UPDATE = 10
 +
  _browser = None
  _temp_path = '/tmp'
  def init(browser, activity, temp_path):
 @@ -214,8 +217,8 @@ class Download:
          path, file_name = os.path.split(self._target_file.path)
          percent = (cur_self_progress  * 100) / max_self_progress

 -        if (time.time() - self._last_update_time) < 5 and \
 -           (percent - self._last_update_percent) < 5:
 +        if (time.time() - self._last_update_time) < _MIN_TIME_UPDATE and
 \
 +           (percent - self._last_update_percent) < _MIN_PERCENT_UPDATE:
              return

          self._last_update_time = time.time()
 }}}

-- 
Ticket URL: <http://dev.laptop.org/ticket/5449#comment:1>
One Laptop Per Child <http://dev.laptop.org>
OLPC bug tracking system



More information about the Bugs mailing list