Merge pull request #50 from joelmathewthomas/bugfix/server

bugfix: fix celery crashing, due to UPLOAD_DIR being deleted
This commit is contained in:
Joel Mathew Thomas
2025-03-21 02:01:18 +05:30
committed by GitHub
+8 -1
View File
@@ -19,9 +19,16 @@ from freqsplit.input.format_checker import is_supported_format
UPLOAD_DIR = "/tmp/freqsplit"
# Ensure the temp directory exists
shutil.rmtree(UPLOAD_DIR)
os.makedirs(UPLOAD_DIR, exist_ok=True)
# Remove all files inside the directory
for filename in os.listdir(UPLOAD_DIR):
file_path = os.path.join(UPLOAD_DIR, filename)
if os.path.isfile(file_path) or os.path.islink(file_path):
os.unlink(file_path)
elif os.path.isdir(file_path):
shutil.rmtree(file_path)
# Endpoint to ping server
@api_view(['GET'])
def ping(request):