##// END OF EJS Templates
fix: lfs chunked uploads....
fix: lfs chunked uploads. When testing large file uploads it's found that gunicorn raises NoMoreData instead of returning value. This fixes the problem and doesn't show excesive exceptions for no reason. Previously file upload still worked but spawned errors in logs

File last commit:

r1152:a0c49580 default
r1280:b2259b07 default
Show More
echo_app.py
56 lines | 1.5 KiB | text/x-python | PythonLexer
# Copyright (C) 2014-2023 RhodeCode GmbH
"""
Implementation of :class:`EchoApp`.
This WSGI application will just echo back the data which it recieves.
"""
import logging
log = logging.getLogger(__name__)
class EchoApp:
def __init__(self, repo_path, repo_name, config):
self._repo_path = repo_path
log.info("EchoApp initialized for %s", repo_path)
def __call__(self, environ, start_response):
log.debug("EchoApp called for %s", self._repo_path)
log.debug("Content-Length: %s", environ.get('CONTENT_LENGTH'))
environ['wsgi.input'].read()
status = '200 OK'
headers = [('Content-Type', 'text/plain')]
start_response(status, headers)
return [b"ECHO"]
class EchoAppStream:
def __init__(self, repo_path, repo_name, config):
self._repo_path = repo_path
log.info("EchoApp initialized for %s", repo_path)
def __call__(self, environ, start_response):
log.debug("EchoApp called for %s", self._repo_path)
log.debug("Content-Length: %s", environ.get('CONTENT_LENGTH'))
environ['wsgi.input'].read()
status = '200 OK'
headers = [('Content-Type', 'text/plain')]
start_response(status, headers)
def generator():
for _ in range(1000000):
yield b"ECHO_STREAM"
return generator()
def create_app():
"""
Allows to run this app directly in a WSGI server.
"""
stub_config = {}
return EchoApp('stub_path', 'stub_name', stub_config)