Merge branch 'dev' into enhancement/bedrock-update-support

This commit is contained in:
Zedifus 2022-09-04 21:03:31 +01:00
commit 88d3facc80
5 changed files with 22 additions and 7 deletions

View File

@ -30,6 +30,11 @@ win-dev-build:
--collect-all tzdata --collect-all tzdata
--collect-all pytz --collect-all pytz
--collect-all six --collect-all six
- |
echo "Retrieving 'latest' updater from crafty-controller/crafty-4-windows-updater"
$src = 'https://gitlab.com/crafty-controller/crafty-4-windows-updater/-/jobs/artifacts/dev/raw/crafty_updater.exe?job=win-dev-build'
$dest = 'crafty_updater.exe'
Invoke-WebRequest -Uri $src -OutFile $dest
# Download latest: # Download latest:
# | https://gitlab.com/crafty-controller/crafty-4/-/jobs/artifacts/dev/download?job=win-dev-build # | https://gitlab.com/crafty-controller/crafty-4/-/jobs/artifacts/dev/download?job=win-dev-build
@ -38,6 +43,7 @@ win-dev-build:
paths: paths:
- app\ - app\
- .\crafty.exe - .\crafty.exe
- .\crafty_updater.exe
exclude: exclude:
- app\classes\**\* - app\classes\**\*
@ -72,6 +78,11 @@ win-prod-build:
--collect-all tzdata --collect-all tzdata
--collect-all pytz --collect-all pytz
--collect-all six --collect-all six
- |
echo "Retrieving 'latest' updater from crafty-controller/crafty-4-windows-updater"
$src = 'https://gitlab.com/crafty-controller/crafty-4-windows-updater/-/jobs/artifacts/master/raw/crafty_updater.exe?job=win-prod-build'
$dest = 'crafty_updater.exe'
Invoke-WebRequest -Uri $src -OutFile $dest
after_script: after_script:
- Add-Content -Path job.env -Value "JOB_ID=$CI_JOB_ID" - Add-Content -Path job.env -Value "JOB_ID=$CI_JOB_ID"
@ -82,6 +93,7 @@ win-prod-build:
paths: paths:
- app\ - app\
- .\crafty.exe - .\crafty.exe
- .\crafty_updater.exe
expire_in: never expire_in: never
exclude: exclude:
- app\classes\**\* - app\classes\**\*

View File

@ -1,9 +1,10 @@
# Changelog # Changelog
## --- [4.0.12] - 2022/TBD ## --- [4.0.12] - 2022/09/04
### New features ### New features
TBD - Win Portable Updater will now be included in Windows Package ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/446))
### Bug fixes ### Bug fixes
TBD - Fix performance issues on server metrics panels (Temporarily setting to 24hr query) ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/440))
- Fix no id on import3 servers ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/442))
### Tweaks ### Tweaks
TBD TBD
### Lang ### Lang

View File

@ -106,11 +106,9 @@ class ServersController(metaclass=Singleton):
return ret return ret
def get_history_stats(self, server_id): def get_history_stats(self, server_id):
max_age = self.helper.get_setting("history_max_age")
now = datetime.datetime.now() now = datetime.datetime.now()
minimum_to_exist = now - datetime.timedelta(days=max_age)
srv = ServersController().get_server_instance_by_id(server_id) srv = ServersController().get_server_instance_by_id(server_id)
return srv.stats_helper.get_history_stats(server_id, minimum_to_exist) return srv.stats_helper.get_history_stats(server_id)
@staticmethod @staticmethod
def update_unloaded_server(server_obj): def update_unloaded_server(server_obj):

View File

@ -1,6 +1,7 @@
import os import os
import logging import logging
import datetime import datetime
from datetime import timedelta
from app.classes.models.servers import Servers, HelperServers from app.classes.models.servers import Servers, HelperServers
from app.classes.shared.helpers import Helpers from app.classes.shared.helpers import Helpers
@ -137,7 +138,8 @@ class HelperServerStats:
) )
return server_data return server_data
def get_history_stats(self, server_id, max_age): def get_history_stats(self, server_id):
max_age = datetime.datetime.now() - timedelta(days=1)
return ( return (
ServerStats.select() ServerStats.select()
.where(ServerStats.created > max_age) .where(ServerStats.created > max_age)

View File

@ -74,6 +74,7 @@ class Import3:
min_mem=(int(server["memory_min"]) / 1000), min_mem=(int(server["memory_min"]) / 1000),
max_mem=(int(server["memory_max"]) / 1000), max_mem=(int(server["memory_max"]) / 1000),
port=server["server_port"], port=server["server_port"],
user_id=HelperUsers.get_user_id_by_name("system"),
) )
Console.info( Console.info(
f"Imported server {server['server_name']}[{server['id']}] " f"Imported server {server['server_name']}[{server['id']}] "
@ -91,6 +92,7 @@ class Import3:
min_mem=(int(json_data["memory_min"]) / 1000), min_mem=(int(json_data["memory_min"]) / 1000),
max_mem=(int(json_data["memory_max"]) / 1000), max_mem=(int(json_data["memory_max"]) / 1000),
port=json_data["server_port"], port=json_data["server_port"],
user_id=HelperUsers.get_user_id_by_name("system"),
) )
Console.info( Console.info(
f"Imported server {json_data['server_name']}[{json_data['id']}] " f"Imported server {json_data['server_name']}[{json_data['id']}] "