Title: [128899] trunk/Tools
Revision
128899
Author
[email protected]
Date
2012-09-18 08:30:27 -0700 (Tue, 18 Sep 2012)

Log Message

EWS shouldn't sleep if there are new patches in its queue
https://bugs.webkit.org/show_bug.cgi?id=83038

Patch by Szilard Ledan <[email protected]> on 2012-09-18
Reviewed by Eric Seidel.

EWS tries to process a security patch. Of course it can't, because the EWS isn't
the member of the security group. But the problem is that after it can't process
the attachment, it says that queue is empty (but it isn't!) and it sleeps 2 minutes
and push the security patch to the end of the queue.
Now it stays in the loop until it finds a patch or the queue gets empty.

* Scripts/webkitpy/tool/commands/queues.py:
(AbstractPatchQueue._next_patch):
* Scripts/webkitpy/tool/commands/queues_unittest.py:
(AbstractPatchQueueTest.test_next_patch):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (128898 => 128899)


--- trunk/Tools/ChangeLog	2012-09-18 15:22:29 UTC (rev 128898)
+++ trunk/Tools/ChangeLog	2012-09-18 15:30:27 UTC (rev 128899)
@@ -1,3 +1,21 @@
+2012-09-18  Szilard Ledan  <[email protected]>
+
+        EWS shouldn't sleep if there are new patches in its queue
+        https://bugs.webkit.org/show_bug.cgi?id=83038
+
+        Reviewed by Eric Seidel.
+
+        EWS tries to process a security patch. Of course it can't, because the EWS isn't
+        the member of the security group. But the problem is that after it can't process
+        the attachment, it says that queue is empty (but it isn't!) and it sleeps 2 minutes
+        and push the security patch to the end of the queue.
+        Now it stays in the loop until it finds a patch or the queue gets empty.
+
+        * Scripts/webkitpy/tool/commands/queues.py:
+        (AbstractPatchQueue._next_patch):
+        * Scripts/webkitpy/tool/commands/queues_unittest.py:
+        (AbstractPatchQueueTest.test_next_patch):
+
 2012-09-18  Mikhail Pozdnyakov  <[email protected]>
 
         [WK2][WTR] InjectedBundle::booleanForKey() should handle literals effectively

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/queues.py (128898 => 128899)


--- trunk/Tools/Scripts/webkitpy/tool/commands/queues.py	2012-09-18 15:22:29 UTC (rev 128898)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/queues.py	2012-09-18 15:30:27 UTC (rev 128899)
@@ -201,18 +201,21 @@
         return self._tool.status_server.update_status(self.name, message, patch, results_file)
 
     def _next_patch(self):
-        patch_id = self._tool.status_server.next_work_item(self.name)
-        if not patch_id:
-            return None
-        patch = self._tool.bugs.fetch_attachment(patch_id)
-        if not patch:
-            # FIXME: Using a fake patch because release_work_item has the wrong API.
-            # We also don't really need to release the lock (although that's fine),
-            # mostly we just need to remove this bogus patch from our queue.
-            # If for some reason bugzilla is just down, then it will be re-fed later.
-            patch = Attachment({'id': patch_id}, None)
-            self._release_work_item(patch)
-            return None
+        # FIXME: Bugzilla accessibility should be checked here; if it's unaccessible,
+        # it should return None.
+        patch = None
+        while not patch:
+            patch_id = self._tool.status_server.next_work_item(self.name)
+            if not patch_id:
+                return None
+            patch = self._tool.bugs.fetch_attachment(patch_id)
+            if not patch:
+                # FIXME: Using a fake patch because release_work_item has the wrong API.
+                # We also don't really need to release the lock (although that's fine),
+                # mostly we just need to remove this bogus patch from our queue.
+                # If for some reason bugzilla is just down, then it will be re-fed later.
+                fake_patch = Attachment({'id': patch_id}, None)
+                self._release_work_item(fake_patch)
         return patch
 
     def _release_work_item(self, patch):

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py (128898 => 128899)


--- trunk/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py	2012-09-18 15:22:29 UTC (rev 128898)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py	2012-09-18 15:30:27 UTC (rev 128899)
@@ -158,12 +158,14 @@
         queue._options = Mock()
         queue._options.port = None
         self.assertEquals(queue._next_patch(), None)
-        tool.status_server = MockStatusServer(work_items=[2, 10000])
+        tool.status_server = MockStatusServer(work_items=[2, 10000, 10001])
         expected_stdout = "MOCK: fetch_attachment: 2 is not a known attachment id\n"  # A mock-only message to prevent us from making mistakes.
         expected_stderr = "MOCK: release_work_item: None 2\n"
-        patch_id = OutputCapture().assert_outputs(self, queue._next_patch, expected_stdout=expected_stdout, expected_stderr=expected_stderr)
-        self.assertEquals(patch_id, None)  # 2 is an invalid patch id
-        self.assertEquals(queue._next_patch().id(), 10000)
+        patch = OutputCapture().assert_outputs(self, queue._next_patch, expected_stdout=expected_stdout, expected_stderr=expected_stderr)
+        # The patch.id() == 2 is ignored because it doesn't exist.
+        self.assertEquals(patch.id(), 10000)
+        self.assertEquals(queue._next_patch().id(), 10001)
+        self.assertEquals(queue._next_patch(), None)    # When the queue is empty
 
     def test_upload_results_archive_for_patch(self):
         queue = AbstractPatchQueue()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to