Delete files from tmp storage after successful processing
What is the problem you are facing?
I run out of temporary disk space when uploading music.
Proposed solution
Delete files in tmp directory when they arn't needed anymore
What are the possible drawbacks or issues with the requested changes?
Improves complexity
Context
I deploy my instance via MASH where the docker container is used and set to --read-only
. A tmpfs is used but limited to 100MB. I receive the following error message when uploading files
May 12 11:18:34 s3 mash-funkwhale-api[1339867]: [2023-05-12 11:18:34 +0000] [9] [ERROR] Exception in ASGI application
May 12 11:18:34 s3 mash-funkwhale-api[1339867]: Traceback (most recent call last):
May 12 11:18:34 s3 mash-funkwhale-api[1339867]: File "/venv/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 419, in run_asgi
May 12 11:18:34 s3 mash-funkwhale-api[1339867]: result = await app( # type: ignore[func-returns-value]
May 12 11:18:34 s3 mash-funkwhale-api[1339867]: File "/venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
May 12 11:18:34 s3 mash-funkwhale-api[1339867]: return await self.app(scope, receive, send)
May 12 11:18:34 s3 mash-funkwhale-api[1339867]: File "/venv/lib/python3.10/site-packages/channels/routing.py", line 62, in __call__
May 12 11:18:34 s3 mash-funkwhale-api[1339867]: return await application(scope, receive, send)
May 12 11:18:34 s3 mash-funkwhale-api[1339867]: File "/venv/lib/python3.10/site-packages/django/core/handlers/asgi.py", line 149, in __call__
May 12 11:18:34 s3 mash-funkwhale-api[1339867]: body_file = await self.read_body(receive)
May 12 11:18:34 s3 mash-funkwhale-api[1339867]: File "/venv/lib/python3.10/site-packages/django/core/handlers/asgi.py", line 181, in read_body
May 12 11:18:34 s3 mash-funkwhale-api[1339867]: body_file.write(message['body'])
May 12 11:18:34 s3 mash-funkwhale-api[1339867]: File "/usr/lib/python3.10/tempfile.py", line 795, in write
May 12 11:18:34 s3 mash-funkwhale-api[1339867]: self._check(file)
May 12 11:18:34 s3 mash-funkwhale-api[1339867]: File "/usr/lib/python3.10/tempfile.py", line 691, in _check
May 12 11:18:34 s3 mash-funkwhale-api[1339867]: self.rollover()
May 12 11:18:34 s3 mash-funkwhale-api[1339867]: File "/usr/lib/python3.10/tempfile.py", line 703, in rollover
May 12 11:18:34 s3 mash-funkwhale-api[1339867]: newfile.write(file.getvalue())
May 12 11:18:34 s3 mash-funkwhale-api[1339867]: OSError: [Errno 28] No space left on device