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 pytz
--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:
# | https://gitlab.com/crafty-controller/crafty-4/-/jobs/artifacts/dev/download?job=win-dev-build
@ -38,6 +43,7 @@ win-dev-build:
paths:
- app\
- .\crafty.exe
- .\crafty_updater.exe
exclude:
- app\classes\**\*
@ -72,6 +78,11 @@ win-prod-build:
--collect-all tzdata
--collect-all pytz
--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:
- Add-Content -Path job.env -Value "JOB_ID=$CI_JOB_ID"
@ -82,6 +93,7 @@ win-prod-build:
paths:
- app\
- .\crafty.exe
- .\crafty_updater.exe
expire_in: never
exclude:
- app\classes\**\*

View File

@ -1,9 +1,10 @@
# Changelog
## --- [4.0.12] - 2022/TBD
## --- [4.0.12] - 2022/09/04
### 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
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
TBD
### Lang

View File

@ -106,11 +106,9 @@ class ServersController(metaclass=Singleton):
return ret
def get_history_stats(self, server_id):
max_age = self.helper.get_setting("history_max_age")
now = datetime.datetime.now()
minimum_to_exist = now - datetime.timedelta(days=max_age)
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
def update_unloaded_server(server_obj):

View File

@ -1,6 +1,7 @@
import os
import logging
import datetime
from datetime import timedelta
from app.classes.models.servers import Servers, HelperServers
from app.classes.shared.helpers import Helpers
@ -137,7 +138,8 @@ class HelperServerStats:
)
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 (
ServerStats.select()
.where(ServerStats.created > max_age)

View File

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