mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Fix metrics schedule lag
This commit is contained in:
parent
cb1490724c
commit
7f412954d7
@ -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):
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user