Title: [238865] trunk/Tools
Revision
238865
Author
aakash_j...@apple.com
Date
2018-12-04 11:34:45 -0800 (Tue, 04 Dec 2018)

Log Message

[ews-app] Run BugzillaPatchFetcher periodically
https://bugs.webkit.org/show_bug.cgi?id=192241

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-app/ews/__init__.py:
* BuildSlaveSupport/ews-app/ews/apps.py:
(EwsConfig.ready): This method is called by Django on startup.
* BuildSlaveSupport/ews-app/ews/fetcher.py:
(FetchLoop): Class which invokes BugzillaPatchFetcher every 60s.

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/ews-app/ews/__init__.py (238864 => 238865)


--- trunk/Tools/BuildSlaveSupport/ews-app/ews/__init__.py	2018-12-04 19:07:57 UTC (rev 238864)
+++ trunk/Tools/BuildSlaveSupport/ews-app/ews/__init__.py	2018-12-04 19:34:45 UTC (rev 238865)
@@ -1,3 +1,5 @@
 import logging
 
 logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(message)s')
+
+default_app_config = 'ews.apps.EwsConfig'

Modified: trunk/Tools/BuildSlaveSupport/ews-app/ews/apps.py (238864 => 238865)


--- trunk/Tools/BuildSlaveSupport/ews-app/ews/apps.py	2018-12-04 19:07:57 UTC (rev 238864)
+++ trunk/Tools/BuildSlaveSupport/ews-app/ews/apps.py	2018-12-04 19:34:45 UTC (rev 238865)
@@ -27,3 +27,8 @@
 
 class EwsConfig(AppConfig):
     name = 'ews'
+
+    def ready(self):
+        # FIXME: Ensure that this method is called only once.
+        from ews.fetcher import FetchLoop
+        FetchLoop()

Modified: trunk/Tools/BuildSlaveSupport/ews-app/ews/fetcher.py (238864 => 238865)


--- trunk/Tools/BuildSlaveSupport/ews-app/ews/fetcher.py	2018-12-04 19:07:57 UTC (rev 238864)
+++ trunk/Tools/BuildSlaveSupport/ews-app/ews/fetcher.py	2018-12-04 19:34:45 UTC (rev 238865)
@@ -21,6 +21,8 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import logging
+import threading
+import time
 
 from ews.common.bugzilla import Bugzilla
 from ews.common.buildbot import Buildbot
@@ -29,6 +31,19 @@
 _log = logging.getLogger(__name__)
 
 
+class FetchLoop():
+    def __init__(self, interval=60):
+        self.interval = interval
+        thread = threading.Thread(target=self.run, args=())
+        thread.daemon = True
+        thread.start()
+
+    def run(self):
+        while True:
+            BugzillaPatchFetcher().fetch()
+            time.sleep(self.interval)
+
+
 class BugzillaPatchFetcher():
     def fetch(self):
         patch_ids = Bugzilla.get_list_of_patches_needing_reviews()

Modified: trunk/Tools/ChangeLog (238864 => 238865)


--- trunk/Tools/ChangeLog	2018-12-04 19:07:57 UTC (rev 238864)
+++ trunk/Tools/ChangeLog	2018-12-04 19:34:45 UTC (rev 238865)
@@ -1,3 +1,16 @@
+2018-12-04  Aakash Jain  <aakash_j...@apple.com>
+
+        [ews-app] Run BugzillaPatchFetcher periodically
+        https://bugs.webkit.org/show_bug.cgi?id=192241
+
+        Reviewed by Lucas Forschler.
+
+        * BuildSlaveSupport/ews-app/ews/__init__.py:
+        * BuildSlaveSupport/ews-app/ews/apps.py:
+        (EwsConfig.ready): This method is called by Django on startup.
+        * BuildSlaveSupport/ews-app/ews/fetcher.py:
+        (FetchLoop): Class which invokes BugzillaPatchFetcher every 60s.
+
 2018-12-04  Jonathan Bedard  <jbed...@apple.com>
 
         webkitpy: Support unicode in MeteredStream
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to