jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/357967 )

Change subject: Don’t dual-serve Thumbor traffic anymore
......................................................................


Don’t dual-serve Thumbor traffic anymore

Bug: T167490
Change-Id: I78aab59bace6070f6e02763028ce878f85d5fd92
---
M puppet/modules/swift/files/SwiftMedia/wmf/rewrite.py
1 file changed, 5 insertions(+), 32 deletions(-)

Approvals:
  jenkins-bot: Verified
  Gilles: Looks good to me, approved



diff --git a/puppet/modules/swift/files/SwiftMedia/wmf/rewrite.py 
b/puppet/modules/swift/files/SwiftMedia/wmf/rewrite.py
index 6c0b2ee..a676803 100644
--- a/puppet/modules/swift/files/SwiftMedia/wmf/rewrite.py
+++ b/puppet/modules/swift/files/SwiftMedia/wmf/rewrite.py
@@ -44,27 +44,6 @@
         # converted  and only the path sent back (eg en.wikipedia/thumb).
         self.backend_url_format = conf['backend_url_format'].strip()  # asis, 
sitelang
 
-    def collectHttpStatusCodes(self, url, thumbor_thread, mediawiki_code):
-        self.logger.debug("Mediawiki: %d %s" % (mediawiki_code, url))
-
-        if thumbor_thread is None:
-            return
-
-        try:
-            # Waits for Thumbor if it took longer than Mediawiki to process 
the image
-            # Otherwise returns/throws exceptions immediately
-            thumbor_result = thumbor_thread.wait()
-            code = thumbor_result.getcode()
-        except urllib2.HTTPError, error:
-            code = error.code
-        except urllib2.URLError, error:
-            code = 503
-
-        self.logger.debug("Thumbor: %d %s" % (code, url))
-
-        if code != mediawiki_code:
-            self.logger.warn("HTTP status code mismatch. Mediawiki: %d 
Thumbor: %d URL: %s" % (mediawiki_code, code, url))
-
     def handle404(self, reqorig, url, container, obj):
         """
         Return a webob.Response which fetches the thumbnail from the thumb
@@ -156,18 +135,14 @@
                 else:
                     self.logger.warn("no sitelang match on encodedurl: %s" % 
encodedurl)
 
-            thumbor_thread = None
-
-            # call thumbor first, otherwise if Mediawiki image scalers return 
an error,
-            # thumbor doesn't get a change to try to generate that thumbnail
             if self.thumborhost:
                 if not self.thumbor_wiki_list or '-'.join((proj, lang)) in 
self.thumbor_wiki_list:
-                    # call Thumbor but don't wait for the result
-                    thumbor_thread = eventlet.spawn(thumbor_opener.open, 
thumbor_encodedurl)
+                    upcopy = thumbor_opener.open(thumbor_encodedurl)
+                else:
+                    upcopy = opener.open(encodedurl)
+            else:
+                upcopy = opener.open(encodedurl)
 
-            # ok, call the encoded url
-            upcopy = opener.open(encodedurl)
-            self.collectHttpStatusCodes(original_request_url, thumbor_thread, 
upcopy.getcode())
         except urllib2.HTTPError, error:
             # copy the urllib2 HTTPError into a webob HTTPError class as-is
 
@@ -184,13 +159,11 @@
                         headers=error.hdrs.items())
 
             resp = CopiedHTTPError()
-            self.collectHttpStatusCodes(original_request_url, thumbor_thread, 
resp.code)
             return resp
         except urllib2.URLError, error:
             msg = 'There was a problem while contacting the image scaler: %s' 
% \
                   error.reason
             resp = webob.exc.HTTPServiceUnavailable(msg)
-            self.collectHttpStatusCodes(original_request_url, thumbor_thread, 
resp.code)
             return resp
 
         # get the Content-Type.

-- 
To view, visit https://gerrit.wikimedia.org/r/357967
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I78aab59bace6070f6e02763028ce878f85d5fd92
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Gilles <gdu...@wikimedia.org>
Gerrit-Reviewer: Gilles <gdu...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to