mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
add catch for restart command. Fix windows bug.
This commit is contained in:
parent
2f1b56121a
commit
5087813900
@ -156,7 +156,7 @@ class helpers_management:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def get_unactioned_commands():
|
def get_unactioned_commands():
|
||||||
query = Commands.select().where(Commands.executed == 0)
|
query = Commands.select().where(Commands.executed == 0)
|
||||||
return db_helper.return_rows(query)
|
return query
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def mark_command_complete(command_id=None):
|
def mark_command_complete(command_id=None):
|
||||||
|
@ -484,7 +484,7 @@ class Server:
|
|||||||
def remove_watcher_thread(self):
|
def remove_watcher_thread(self):
|
||||||
logger.info("Removing old crash detection watcher thread")
|
logger.info("Removing old crash detection watcher thread")
|
||||||
console.info("Removing old crash detection watcher thread")
|
console.info("Removing old crash detection watcher thread")
|
||||||
schedule.clear(self.name)
|
self.crash_watcher_schedule.remove(self.server_name)
|
||||||
|
|
||||||
def agree_eula(self, user_id):
|
def agree_eula(self, user_id):
|
||||||
file = os.path.join(self.server_path, 'eula.txt')
|
file = os.path.join(self.server_path, 'eula.txt')
|
||||||
|
@ -85,9 +85,14 @@ class TasksManager:
|
|||||||
# select any commands waiting to be processed
|
# select any commands waiting to be processed
|
||||||
commands = management_helper.get_unactioned_commands()
|
commands = management_helper.get_unactioned_commands()
|
||||||
for c in commands:
|
for c in commands:
|
||||||
svr = self.controller.get_server_obj(c['server_id']['server_id'])
|
try:
|
||||||
user_id = c.get('user')['user_id']
|
svr = self.controller.get_server_obj(c.server_id)
|
||||||
command = c.get('command', None)
|
except:
|
||||||
|
logger.error("Server value requested does note exist purging item from waiting commands.")
|
||||||
|
management_helper.mark_command_complete(c.command_id)
|
||||||
|
|
||||||
|
user_id = c.user_id
|
||||||
|
command = c.command
|
||||||
|
|
||||||
if command == 'start_server':
|
if command == 'start_server':
|
||||||
svr.run_threaded_server(user_id)
|
svr.run_threaded_server(user_id)
|
||||||
@ -105,7 +110,7 @@ class TasksManager:
|
|||||||
svr.jar_update()
|
svr.jar_update()
|
||||||
else:
|
else:
|
||||||
svr.send_command(command)
|
svr.send_command(command)
|
||||||
management_helper.mark_command_complete(c.get('command_id', None))
|
management_helper.mark_command_complete(c.command_id)
|
||||||
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user