Mercurial > p > roundup > code
comparison roundup/cgi/wsgi_handler.py @ 6321:979cecdb70f8
Pre-load imports and templates for wsgi
This triggers preloading once in __init__ doing essentially the same
thing as in __call__. This avoids burdening the first request with the
startup cost. Fixes issue2551112.
Thanks to Robert Klonner for the patch.
| author | Ralf Schlatterbeck <rsc@runtux.com> |
|---|---|
| date | Wed, 03 Feb 2021 17:53:55 +0100 |
| parents | 3cba8949bfe0 |
| children | 0343b6fea4b9 |
comparison
equal
deleted
inserted
replaced
| 6320:6dabae8da31a | 6321:979cecdb70f8 |
|---|---|
| 82 if lang: | 82 if lang: |
| 83 self.translator = TranslationService.get_translation(lang, | 83 self.translator = TranslationService.get_translation(lang, |
| 84 tracker_home=home) | 84 tracker_home=home) |
| 85 else: | 85 else: |
| 86 self.translator = None | 86 self.translator = None |
| 87 # trigger pre-loading of imports and templates | |
| 88 with self.get_tracker(): | |
| 89 pass | |
| 87 | 90 |
| 88 def __call__(self, environ, start_response): | 91 def __call__(self, environ, start_response): |
| 89 """Initialize with `apache.Request` object""" | 92 """Initialize with `apache.Request` object""" |
| 90 request = RequestHandler(environ, start_response) | 93 request = RequestHandler(environ, start_response) |
| 91 | 94 |
