Skip to content

Commit 4f4c919

Browse files
committed
keep file open
1 parent 1dd5461 commit 4f4c919

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

codespeed/admin_views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,13 @@ def download_db(request):
158158
try:
159159
_build_sqlite(path)
160160
f = open(path, 'rb')
161-
os.unlink(path) # unlink now; data survives until f is closed
162161
today = datetime.today().strftime('%Y-%m-%d')
163162
response = FileResponse(
164163
f,
165164
as_attachment=True,
166165
filename=f'codespeed-{today}.sqlite3',
167166
)
167+
os.unlink(path) # unlink after FileResponse reads the file size
168168
response.set_cookie(
169169
'codespeed_download_ready', '1',
170170
max_age=60, path='/', samesite='Lax',

0 commit comments

Comments
 (0)