mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Merge branch 'creation-fix' into 'dev'
Fixes error thrown when server download doesn't finish before server creation ends. See merge request crafty-controller/crafty-commander!64
This commit is contained in:
commit
f1cbb78f40
@ -11,6 +11,7 @@ from app.classes.shared.helpers import helper
|
||||
from app.classes.shared.console import console
|
||||
from app.classes.shared.models import Servers
|
||||
from app.classes.minecraft.server_props import ServerProps
|
||||
from app.classes.web.websocket_helper import websocket_helper
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -173,11 +174,11 @@ class ServerJars:
|
||||
response = self._get_api_result(url)
|
||||
return response
|
||||
|
||||
def download_jar(self, server, version, path):
|
||||
update_thread = threading.Thread(target=self.a_download_jar, daemon=True, name="exe_download", args=(server, version, path))
|
||||
def download_jar(self, server, version, path, name):
|
||||
update_thread = threading.Thread(target=self.a_download_jar, daemon=True, name="exe_download", args=(server, version, path, name))
|
||||
update_thread.start()
|
||||
|
||||
def a_download_jar(self, server, version, path):
|
||||
def a_download_jar(self, server, version, path, name):
|
||||
fetch_url = "{base}/api/fetchJar/{server}/{version}".format(base=self.base_url, server=server, version=version)
|
||||
|
||||
# open a file stream
|
||||
@ -189,6 +190,8 @@ class ServerJars:
|
||||
except Exception as e:
|
||||
logger.error("Unable to save jar to {path} due to error:{error}".format(path=path, error=e))
|
||||
pass
|
||||
websocket_helper.broadcast('notification', "Executable download finished for server named: " + name)
|
||||
|
||||
|
||||
return False
|
||||
|
||||
|
@ -297,7 +297,7 @@ class Controller:
|
||||
server_stop = "stop"
|
||||
|
||||
# download the jar
|
||||
server_jar_obj.download_jar(server, version, full_jar_path)
|
||||
server_jar_obj.download_jar(server, version, full_jar_path, name)
|
||||
|
||||
new_id = self.register_server(name, server_id, server_dir, backup_path, server_command, server_file, server_log_file, server_stop)
|
||||
return new_id
|
||||
|
@ -115,7 +115,6 @@ class Server:
|
||||
self.settings = server_data_obj
|
||||
|
||||
# build our server run command
|
||||
self.setup_server_run_command()
|
||||
|
||||
if server_data_obj['auto_start']:
|
||||
delay = int(self.settings['auto_start_delay'])
|
||||
|
Loading…
Reference in New Issue
Block a user