[Commits] sugar-update-control branch master updated.

Martin Langhoff martin at laptop.org
Fri Nov 27 09:40:20 EST 2009


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "/home/cscott/public_git/sugar-update-control".

The branch, master has been updated
       via  68fe82925b08040fd4a888672cd8838ca3313f54 (commit)
      from  c399dbe94b0617facf08a3dba71f5ce2e0aecede (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

 src/model.py |   30 +++++++++++++++++++++++-------
 1 files changed, 23 insertions(+), 7 deletions(-)

- Log -----------------------------------------------------------------
commit 68fe82925b08040fd4a888672cd8838ca3313f54
Author: Martin Langhoff <martin at laptop.org>
Date:   Fri Nov 27 14:42:39 2009 +0100

    Trust the XS version of the Activity to be latest (dlo#9259)
    
    When refreshing/updating existing activities, if the local XS
    has a copy of the activity, trust that it is the most current one
    and skip contacting the upstream server.
    
    Patch by Daniel Drake <dsd at laptop.org>

diff --git a/src/model.py b/src/model.py
index 912ae80..5362902 100755
--- a/src/model.py
+++ b/src/model.py
@@ -350,18 +350,34 @@ class UpdateList(gtk.ListStore):
         def refresh_existing(row):
             """Look for updates to an existing activity."""
             act = row[ACTIVITY_BUNDLE]
+            oldver = 0 if _DEBUG_MAKE_ALL_OLD else act.get_activity_version()
             def net_good(url_): self._saw_network_success = True
             def net_bad(url): self._network_failures.append(url)
-            oldver, newver, newurl, size = \
-                    _retrieve_update_version(act, net_good, net_bad)
-            # merge w/ info from the activity group
-            # (activity group entries have UPDATE_EXISTS=True)
-            if row[UPDATE_EXISTS] and \
-               ((act.get_activity_version() if newver is None else newver) \
-                < row[UPDATE_VERSION]):
+
+            # activity group entries have UPDATE_EXISTS=True
+            # for any activities not present in the group, try their update_url
+            # (if any) for new updates
+            # note the behaviour here: if the XS (which hosts activity groups)
+            # has an entry for the activity, then we trust that it is the
+            # latest and we don't go online to check.
+            # we only go online for activities which the XS does not know about
+            # the purpose of this is to reduce the high latency of having
+            # to check multiple update_urls on a slow connection.
+
+            if row[UPDATE_EXISTS]:
+                # trust what the XS told us
                 newver, newurl = row[UPDATE_VERSION], row[UPDATE_URL]
                 size = urlrange.urlopen(row[UPDATE_URL], timeout=HTTP_TIMEOUT)\
                        .length()
+            else:
+                # hit the internet for updates
+                oldver, newver, newurl, size = \
+                    _retrieve_update_version(act, net_good, net_bad)
+
+            # make sure that the version we found is actually newer...
+            if newver is not None and newver <= act.get_activity_version():
+                newver = None
+
             row[UPDATE_EXISTS] = (newver is not None)
             row[UPDATE_URL] = newurl
             row[UPDATE_SIZE] = size
-----------------------------------------------------------------------


--
/home/cscott/public_git/sugar-update-control


More information about the Commits mailing list