2009-11-28 Adam Barth <abarth@webkit.org>
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 29 Nov 2009 01:53:38 +0000 (01:53 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 29 Nov 2009 01:53:38 +0000 (01:53 +0000)
        Reviewed by Eric Seidel.

        [bzt] style-queue sends ~100 requests to QueueStatusServer every 5 minutes
        https://bugs.webkit.org/show_bug.cgi?id=31950

        Now we cache the last status that we get back from QueueStatusServer.
        Eventually we'll have to do something more fancy if we want to support
        a "try again" button on QueueStatusServer, but we can cross that bridge
        when we come to it.

        * Scripts/modules/patchcollection.py:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@51465 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitTools/ChangeLog
WebKitTools/Scripts/modules/patchcollection.py

index a88e17fb62faced915b0827527cdf76c33ddb04f..dea140fadbdade05c71a274d0da15acb1dfff468 100644 (file)
@@ -1,3 +1,17 @@
+2009-11-28  Adam Barth  <abarth@webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        [bzt] style-queue sends ~100 requests to QueueStatusServer every 5 minutes
+        https://bugs.webkit.org/show_bug.cgi?id=31950
+
+        Now we cache the last status that we get back from QueueStatusServer.
+        Eventually we'll have to do something more fancy if we want to support
+        a "try again" button on QueueStatusServer, but we can cross that bridge
+        when we come to it.
+
+        * Scripts/modules/patchcollection.py:
+
 2009-11-28  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Eric Seidel.
index d8ca0db7d8e6c3c75d67fc9fa9ca7b9c8ecbd487..1a774bacdd9ff13acd543a83c8978022246afd83 100644 (file)
@@ -77,12 +77,22 @@ class PersistentPatchCollection:
         self._delegate = delegate
         self._name = self._delegate.collection_name()
         self._status = self._delegate.status_server()
+        self._status_cache = {}
+
+    def _cached_status(self, patch_id):
+        cached = self._status_cache.get(patch_id)
+        if cached:
+            return cached
+        status = self._status.patch_status(self._name, patch_id)
+        if status:
+            self._status_cache[patch_id] = status
+        return status
 
     def next(self):
         patch_ids = self._delegate.fetch_potential_patch_ids()
         for patch_id in patch_ids:
-            last_status = self._status.patch_status(self._name, patch_id)
-            if not last_status: # FIXME: Add support for "Try again"
+            status = self._cached_status(patch_id)
+            if not status:
                 return patch_id
 
     def done(self, patch):