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:
parent
6db9b4d75d
commit
da7a5e22e3
@ -93,6 +93,7 @@ class LogManager(metaclass=singleton.Singleton):
|
|||||||
message: str,
|
message: str,
|
||||||
source: str,
|
source: str,
|
||||||
avoidDuplicates: bool,
|
avoidDuplicates: bool,
|
||||||
|
keepLogSize: bool = True,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Logs a message associated to owner
|
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)
|
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
|
# 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(
|
for i in qs.order_by(
|
||||||
'-created',
|
'-created',
|
||||||
)[GlobalConfig.MAX_LOGS_PER_ELEMENT.getInt() - 1 :]:
|
)[GlobalConfig.MAX_LOGS_PER_ELEMENT.getInt() - 1 :]:
|
||||||
|
@ -75,7 +75,6 @@ class MessageProcessorThread(BaseThread):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
while self.keepRunning:
|
while self.keepRunning:
|
||||||
|
|
||||||
# Locate all notifications from "persistent" and try to process them
|
# Locate all notifications from "persistent" and try to process them
|
||||||
# If no notification can be fully resolved, it will be kept in the database
|
# If no notification can be fully resolved, it will be kept in the database
|
||||||
for n in Notification.getPersistentQuerySet().all():
|
for n in Notification.getPersistentQuerySet().all():
|
||||||
|
Loading…
Reference in New Issue
Block a user