Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
nggit committed Nov 7, 2023
1 parent 2b0fc77 commit 6eef1aa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
8 changes: 0 additions & 8 deletions tests/asgi_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

__all__ = ('app', 'ASGI_HOST', 'ASGI_PORT')

import asyncio # noqa: E402
import os # noqa: E402
import sys # noqa: E402

Expand Down Expand Up @@ -122,11 +121,4 @@ async def app(scope, receive, send):
})

if __name__ == '__main__':
try:
import uvloop

asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
except ImportError:
print('INFO: uvloop is not installed')

tremolo.run(app, host=ASGI_HOST, port=ASGI_PORT, debug=True, worker_num=2)
6 changes: 3 additions & 3 deletions tremolo/lib/http_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,10 @@ async def sendfile(
self._request.context.RESPONSE_SENDFILE_HANDLE.close
)

file_size = os.stat(path).st_size
mtime = os.path.getmtime(path)
st = os.stat(path)
file_size = st.st_size
mdate = time.strftime('%a, %d %b %Y %H:%M:%S GMT',
time.gmtime(mtime)).encode('latin-1')
time.gmtime(st.st_mtime)).encode('latin-1')

if (self._request.version == b'1.1' and
b'range' in self._request.headers):
Expand Down

0 comments on commit 6eef1aa

Please sign in to comment.