Gilles has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/357968 )
Change subject: Disable Thumbor dual-serving and serve testwiki with Thumbor
......................................................................
Disable Thumbor dual-serving and serve testwiki with Thumbor
Bug: T167490
Change-Id: Ia943a020b360308fe1d11d8e7ee9ddf8fffc375d
---
M hieradata/common/swift/proxy.yaml
M modules/swift/files/SwiftMedia/wmf/rewrite.py
2 files changed, 8 insertions(+), 70 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/68/357968/1
diff --git a/hieradata/common/swift/proxy.yaml
b/hieradata/common/swift/proxy.yaml
index c65a3d3..25cefb5 100644
--- a/hieradata/common/swift/proxy.yaml
+++ b/hieradata/common/swift/proxy.yaml
@@ -57,19 +57,6 @@
]
swift::proxy::thumbor_wiki_list: [
- 'wikimedia-commons',
- 'wikipedia-en', 'wikipedia-ja', 'wikipedia-de', 'wikipedia-ru',
- 'wikipedia-it', 'wikipedia-pt', 'wikipedia-he', 'wikipedia-fr',
- 'wikipedia-id', 'wikipedia-zh', 'wikipedia-th', 'wikipedia-uk',
- 'wikipedia-ar', 'wikipedia-tr', 'wikipedia-es',
- 'wikipedia-fa', 'wikipedia-vi', 'wikipedia-fi', 'wikipedia-hu',
- 'wikipedia-ro', 'wikipedia-sr', 'wikipedia-ko', 'wikipedia-ms',
- 'wikipedia-arz', 'wikipedia-az', 'wikipedia-el', 'wikipedia-lt',
- 'wikipedia-hr', 'wikipedia-lv', 'wikipedia-af', 'wikipedia-bs',
- 'wikipedia-te', 'wikipedia-ka', 'wikipedia-ta', 'wikipedia-sq',
- 'wikipedia-kk', 'wikibooks-de', 'wikipedia-hi', 'wikipedia-sl',
- 'wikibooks-en', 'wikipedia-cy', 'wikipedia-bn', 'wikipedia-ca',
- 'wikiversity-en', 'wikipedia-mr', 'wikipedia-gl', 'wikipedia-sh',
- 'wikipedia-hy', 'wikisource-ar', 'wikipedia-my'
+ 'wikipedia-test'
# no trailing comma!
]
diff --git a/modules/swift/files/SwiftMedia/wmf/rewrite.py
b/modules/swift/files/SwiftMedia/wmf/rewrite.py
index 35dec2c..4e7d733 100644
--- a/modules/swift/files/SwiftMedia/wmf/rewrite.py
+++ b/modules/swift/files/SwiftMedia/wmf/rewrite.py
@@ -50,30 +50,6 @@
self.backend_url_format = conf['backend_url_format'].strip() # asis,
sitelang
self.tld = conf['tld'].strip()
- 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
@@ -175,24 +151,13 @@
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)
-
- # ok, call the encoded url
- upcopy = opener.open(encodedurl)
- eventlet.spawn(
- self.collectHttpStatusCodes,
- original_request_url,
- thumbor_thread,
- upcopy.getcode()
- )
-
+ upcopy = thumbor_opener.open(thumbor_encodedurl)
+ else:
+ upcopy = opener.open(encodedurl)
+ else:
+ upcopy = opener.open(encodedurl)
except urllib2.HTTPError, error:
# copy the urllib2 HTTPError into a webob HTTPError class as-is
@@ -208,25 +173,11 @@
detail="".join(error.readlines()),
headers=error.hdrs.items())
- resp = CopiedHTTPError()
- eventlet.spawn(
- self.collectHttpStatusCodes,
- original_request_url,
- thumbor_thread,
- resp.code
- )
- return resp
+ return CopiedHTTPError()
except urllib2.URLError, error:
msg = 'There was a problem while contacting the image scaler: %s'
% \
error.reason
- resp = webob.exc.HTTPServiceUnavailable(msg)
- eventlet.spawn(
- self.collectHttpStatusCodes,
- original_request_url,
- thumbor_thread,
- resp.code
- )
- return resp
+ return webob.exc.HTTPServiceUnavailable(msg)
# get the Content-Type.
uinfo = upcopy.info()
--
To view, visit https://gerrit.wikimedia.org/r/357968
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia943a020b360308fe1d11d8e7ee9ddf8fffc375d
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Gilles <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits