From 6d938cabc8794918aa12ad3bd8e4757cc40e60b1 Mon Sep 17 00:00:00 2001 From: amcmanu3 Date: Wed, 4 Oct 2023 12:45:23 -0400 Subject: [PATCH 1/8] Set some stats logging to debug Add stop server logging --- app/classes/minecraft/stats.py | 2 +- app/classes/shared/server.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/classes/minecraft/stats.py b/app/classes/minecraft/stats.py index c336612a..a3f85c05 100644 --- a/app/classes/minecraft/stats.py +++ b/app/classes/minecraft/stats.py @@ -226,7 +226,7 @@ class Stats: def get_server_players(self, server_id): server = HelperServers.get_server_data_by_id(server_id) - logger.info(f"Getting players for server {server}") + logger.debug(f"Getting players for server {server['server_name']}") internal_ip = server["server_ip"] server_port = server["server_port"] diff --git a/app/classes/shared/server.py b/app/classes/shared/server.py index 2f62dc68..8bc31a52 100644 --- a/app/classes/shared/server.py +++ b/app/classes/shared/server.py @@ -792,6 +792,7 @@ class ServerInstance: f"Assuming it was never started." ) if self.settings["stop_command"]: + logger.info(f"Stop command requested for {self.settings['server_name']}.") self.send_command(self.settings["stop_command"]) self.write_player_cache() else: @@ -1631,7 +1632,7 @@ class ServerInstance: def get_server_players(self): server = HelperServers.get_server_data_by_id(self.server_id) - logger.info(f"Getting players for server {server}") + logger.debug(f"Getting players for server {server['server_name']}") internal_ip = server["server_ip"] server_port = server["server_port"] From 447e04cb8e09b9ffe7504d1e19e395b930d7bc6a Mon Sep 17 00:00:00 2001 From: amcmanu3 Date: Thu, 5 Oct 2023 16:22:42 -0400 Subject: [PATCH 2/8] Add log message on restart --- app/classes/shared/server.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/classes/shared/server.py b/app/classes/shared/server.py index 8bc31a52..7febadea 100644 --- a/app/classes/shared/server.py +++ b/app/classes/shared/server.py @@ -862,6 +862,9 @@ class ServerInstance: if not self.check_running(): self.run_threaded_server(user_id) else: + logger.info( + f"Restart command detected. Sending stop command to {self.server_id}." + ) self.stop_threaded_server() time.sleep(2) self.run_threaded_server(user_id) From 7a410a2b0ef9e0e4266ade36d80f70137b0c71c8 Mon Sep 17 00:00:00 2001 From: amcmanu3 Date: Thu, 5 Oct 2023 17:48:55 -0400 Subject: [PATCH 3/8] Fix bug reaction schedule could be child of parent --- app/classes/shared/tasks.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/classes/shared/tasks.py b/app/classes/shared/tasks.py index c89be9d8..aac4d33a 100644 --- a/app/classes/shared/tasks.py +++ b/app/classes/shared/tasks.py @@ -330,6 +330,8 @@ class TasksManager: # Check to see if it's enabled and is not a chain reaction. if job_data["enabled"] and job_data["interval_type"] != "reaction": + # Lets make sure this can not be mistaken for a reaction + job_data["parent"] = None new_job = "error" if job_data["cron_string"] != "": try: @@ -450,7 +452,10 @@ class TasksManager: def update_job(self, sch_id, job_data): # Checks to make sure some doofus didn't actually make the newly # created task a child of itself. - if str(job_data.get("parent")) == str(sch_id): + if ( + str(job_data.get("parent")) == str(sch_id) + or job_data["interval_type"] != "reaction" + ): job_data["parent"] = None HelpersManagement.update_scheduled_task(sch_id, job_data) @@ -609,7 +614,10 @@ class TasksManager: ): # event job ID's are strings so we need to look at # this as the same data type. - if str(schedule.parent) == str(event.job_id): + if ( + str(schedule.parent) == str(event.job_id) + and schedule.interval_type == "reaction" + ): if schedule.enabled: delaytime = datetime.datetime.now() + datetime.timedelta( seconds=schedule.delay From 5525413724eddc437adca44c3d9f7b657cbdcacb Mon Sep 17 00:00:00 2001 From: amcmanu3 Date: Fri, 6 Oct 2023 13:33:56 -0400 Subject: [PATCH 4/8] Set timeout before calling dir function --- app/frontend/templates/server/bedrock_wizard.html | 8 ++++++-- app/frontend/templates/server/wizard.html | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/frontend/templates/server/bedrock_wizard.html b/app/frontend/templates/server/bedrock_wizard.html index 4193c6d7..823a4585 100644 --- a/app/frontend/templates/server/bedrock_wizard.html +++ b/app/frontend/templates/server/bedrock_wizard.html @@ -591,7 +591,9 @@ message: '

Please wait while we gather your files...

', closeButton: false }); - getDirView(); + setTimeout(function(){ + getDirView(); + }, 2000); } else { bootbox.alert("You must input a path before selecting this button"); } @@ -638,7 +640,9 @@ message: '

Please wait while we gather your files...

', closeButton: false }); - getDirView(); + setTimeout(function(){ + getDirView(); + }, 2000); } else { bootbox.alert("You must input a path before selecting this button"); } diff --git a/app/frontend/templates/server/wizard.html b/app/frontend/templates/server/wizard.html index 850bf505..fbc89f50 100644 --- a/app/frontend/templates/server/wizard.html +++ b/app/frontend/templates/server/wizard.html @@ -827,7 +827,9 @@ closeButton: false }); console.log("CALLING DIR") - getDirView(); + setTimeout(function(){ + getDirView(); + }, 2000); } else { bootbox.alert("You must input a path before selecting this button"); } @@ -844,7 +846,9 @@ closeButton: false }); console.log("CALLING DIR") - getDirView(); + setTimeout(function(){ + getDirView(); + }, 2000); }); var upload = false; var file; From 4f994ce211fbef65e5e13b25cf7329a5b0469024 Mon Sep 17 00:00:00 2001 From: amcmanu3 Date: Fri, 6 Oct 2023 14:24:55 -0400 Subject: [PATCH 5/8] Remove un-needed console log --- app/frontend/templates/server/wizard.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/frontend/templates/server/wizard.html b/app/frontend/templates/server/wizard.html index fbc89f50..bb5fc175 100644 --- a/app/frontend/templates/server/wizard.html +++ b/app/frontend/templates/server/wizard.html @@ -826,7 +826,6 @@ message: '

Please wait while we gather your files...

', closeButton: false }); - console.log("CALLING DIR") setTimeout(function(){ getDirView(); }, 2000); @@ -845,7 +844,6 @@ message: '

Please wait while we gather your files...

', closeButton: false }); - console.log("CALLING DIR") setTimeout(function(){ getDirView(); }, 2000); From d750b2946143174ee5c3059cf50476315a20a96e Mon Sep 17 00:00:00 2001 From: Zedifus Date: Sat, 7 Oct 2023 15:45:30 +0100 Subject: [PATCH 6/8] Update changelog !635 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce01d1b7..f4b0a708 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ - Make files hover cursor pointer ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/627)) - Use `Jar` class naming for jar refresh to make room for steamCMD naming in the future ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/630)) - Improve ui visibility of Build Wizard selection tabs ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/633)) +- Add additional logging for server bootstrap & moves unnecessary logging to `debug` for improved log clarity ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/635)) ### Lang TBD

From 87d81f3ad7f5c847603c9ecca56314ca9554fad3 Mon Sep 17 00:00:00 2001 From: Zedifus Date: Sat, 7 Oct 2023 16:11:03 +0100 Subject: [PATCH 7/8] Update changelog !636 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f4b0a708..a3a721b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Fix public status page not updating #255 ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/615)) - Fix service worker vulrn and CQ raised by SonarQ ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/631)) - Fix Backup Restore/Schedules, Backup button function on `remote-comms2` ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/634)) +- Fix bug where a reaction loop could be created, but would be cut short by an error when the loop occurred ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/636)) ### Refactor - Consolidate remaining frontend functions into API V2, and remove ajax internal API ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/585)) - Replace bleach with nh3 ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/628)) From ca430f991b1a63d44bb82b87f3747e472f5487be Mon Sep 17 00:00:00 2001 From: Zedifus Date: Sat, 7 Oct 2023 16:48:27 +0100 Subject: [PATCH 8/8] Update changelog !637 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 266ec6bf..989d3b67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - Fix public status page not updating #255 ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/615)) - Fix service worker vulrn and CQ raised by SonarQ ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/631)) - Fix Backup Restore/Schedules, Backup button function on `remote-comms2` ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/634)) +- Add a wait to the call for the directory so we can make sure the wait dialogue has time to show up first ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/637)) ### Refactor - Consolidate remaining frontend functions into API V2, and remove ajax internal API ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/585)) - Replace bleach with nh3 ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/628))