worker: Use threading to run new site in bg
All checks were successful
Build Docker / Build Master (push) Successful in 27s
Build Docker / Build Bot (push) Successful in 26s

This commit is contained in:
Nathan Woodburn 2023-08-17 13:36:57 +10:00
parent d6db4adf50
commit cda318eeeb
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -3,6 +3,7 @@
from flask import Flask, request, jsonify
import dotenv
import os
import threading
dotenv.load_dotenv()
@ -25,7 +26,9 @@ def new_site():
sites_file.close()
# New site in background
new_site(domain,5000+count)
thread = threading.Thread(target=new_site, args=(domain, 5000 + count))
thread.start()
# Return the domain and the number of sites
return jsonify({'domain': domain, 'count': count})