1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +03:00

Started adding support for "local files" logs to be also stored on DB

This commit is contained in:
Adolfo Gómez García 2023-04-15 00:24:26 +02:00
parent 6db9b4d75d
commit da7a5e22e3
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23
2 changed files with 2 additions and 2 deletions

View File

@ -93,6 +93,7 @@ class LogManager(metaclass=singleton.Singleton):
message: str,
source: str,
avoidDuplicates: bool,
keepLogSize: bool = True,
):
"""
Logs a message associated to owner
@ -102,7 +103,7 @@ class LogManager(metaclass=singleton.Singleton):
qs = models.Log.objects.filter(owner_id=owner_id, owner_type=owner_type)
# First, ensure we do not have more than requested logs, and we can put one more log item
if qs.count() >= GlobalConfig.MAX_LOGS_PER_ELEMENT.getInt():
if keepLogSize and qs.count() >= GlobalConfig.MAX_LOGS_PER_ELEMENT.getInt():
for i in qs.order_by(
'-created',
)[GlobalConfig.MAX_LOGS_PER_ELEMENT.getInt() - 1 :]:

View File

@ -75,7 +75,6 @@ class MessageProcessorThread(BaseThread):
def run(self):
while self.keepRunning:
# Locate all notifications from "persistent" and try to process them
# If no notification can be fully resolved, it will be kept in the database
for n in Notification.getPersistentQuerySet().all():