Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: devserver.py

Issue 3162004: Increase the accepted connection socket timeout. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/dev-util.git
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import autoupdate 5 import autoupdate
6 import buildutil 6 import buildutil
7 import optparse 7 import optparse
8 import os 8 import os
9 import sys 9 import sys
10 import web 10 import web
(...skipping 20 matching lines...) Expand all
31 of the output file. 31 of the output file.
32 """ 32 """
33 def POST(self): 33 def POST(self):
34 input = web.input() 34 input = web.input()
35 web.debug('emerging %s ' % input.pkg) 35 web.debug('emerging %s ' % input.pkg)
36 emerge_command = 'emerge-%s %s' % (input.board, input.pkg) 36 emerge_command = 'emerge-%s %s' % (input.board, input.pkg)
37 err = os.system(emerge_command) 37 err = os.system(emerge_command)
38 if err != 0: 38 if err != 0:
39 raise Exception('failed to execute %s' % emerge_command) 39 raise Exception('failed to execute %s' % emerge_command)
40 40
41 def OverrideWSGIServer(server_address, wsgi_app):
42 """Creates a CherryPyWSGIServer instance.
43
44 Overrides web.py's WSGIServer routine (web.httpserver.WSGIServer) to
45 increase the accepted connection socket timeout from the default 10
46 seconds to 10 minutes. The extra time is necessary to serve delta
47 updates as well as update requests from a low priority update_engine
48 process running on a heavily loaded Chrome OS device.
49 """
50 web.debug('using local OverrideWSGIServer routine')
51 from web.wsgiserver import CherryPyWSGIServer
52 return CherryPyWSGIServer(server_address, wsgi_app, server_name="localhost",
53 timeout=600)
54
41 if __name__ == '__main__': 55 if __name__ == '__main__':
42 usage = 'usage: %prog [options]' 56 usage = 'usage: %prog [options]'
43 parser = optparse.OptionParser(usage) 57 parser = optparse.OptionParser(usage)
44 parser.add_option('--archive_dir', dest='archive_dir', 58 parser.add_option('--archive_dir', dest='archive_dir',
45 help='serve archived builds only.') 59 help='serve archived builds only.')
46 parser.add_option('--client_prefix', dest='client_prefix', 60 parser.add_option('--client_prefix', dest='client_prefix',
47 help='Required prefix for client software version.', 61 help='Required prefix for client software version.',
48 default='MementoSoftwareUpdate') 62 default='MementoSoftwareUpdate')
49 parser.add_option('--factory_config', dest='factory_config', 63 parser.add_option('--factory_config', dest='factory_config',
50 help='Config file for serving images from factory floor.') 64 help='Config file for serving images from factory floor.')
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 factory_config_path=options.factory_config, 109 factory_config_path=options.factory_config,
96 validate_factory_config=options.validate_factory_config, 110 validate_factory_config=options.validate_factory_config,
97 client_prefix=options.client_prefix) 111 client_prefix=options.client_prefix)
98 if options.validate_factory_config: 112 if options.validate_factory_config:
99 sys.exit(0) 113 sys.exit(0)
100 urls = ('/', 'index', 114 urls = ('/', 'index',
101 '/update', 'update', 115 '/update', 'update',
102 '/update/(.+)', 'update', 116 '/update/(.+)', 'update',
103 '/build', 'build') 117 '/build', 'build')
104 118
119 # Overrides the default WSGIServer routine -- see OverrideWSGIServer.
120 web.httpserver.WSGIServer = OverrideWSGIServer
105 app = web.application(urls, globals(), autoreload=True) 121 app = web.application(urls, globals(), autoreload=True)
106 render = web.template.render('templates/') 122 render = web.template.render('templates/')
107 app.run() 123 app.run()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698