Skip to content

Commit

Permalink
Merge pull request #572 from TeskaLabs/feature/housekeeping-2405
Browse files Browse the repository at this point in the history
Improve Housekeeping logging
  • Loading branch information
mejroslav committed May 7, 2024
2 parents a536244 + d31f30c commit 6e5414e
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions asab/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,9 +773,10 @@ def _on_housekeeping_tick(self, message_type):

if self.HousekeepingTime < now:
if now < self.HousekeepingTimeLimit and self.HousekeepingId <= today_id:
L.log(asab.LOG_NOTICE, "Housekeeping started.")
self.PubSub.publish("Application.housekeeping!")
else:
L.warning(
L.error(
"Housekeeping has not been executed: It is past the time limit.",
struct_data={
"housekeeping_time": self.HousekeepingTime.strftime("%Y-%m-%d %H:%M:%S"),
Expand All @@ -788,18 +789,9 @@ def _on_housekeeping_tick(self, message_type):
self.HousekeepingTime += datetime.timedelta(days=1)
self.HousekeepingTimeLimit += datetime.timedelta(days=1)
self.HousekeepingId = _housekeeping_id(self.HousekeepingTime)
L.log(
LOG_NOTICE,
"Setting time for the next housekeeping.",
struct_data={
"next_housekeeping_time": self.HousekeepingTime.strftime("%Y-%m-%d %H:%M:%S"),
"next_time_limit": self.HousekeepingTimeLimit.strftime("%Y-%m-%d %H:%M:%S"),
"next_housekeeping_id": self.HousekeepingId,
}
)

if len(self.HousekeepingMissedEvents) > 0:
L.warning(
L.error(
"One or more Housekeeping events have not been executed.",
struct_data={
"missed_housekeeping_events": self.HousekeepingMissedEvents
Expand Down

0 comments on commit 6e5414e

Please sign in to comment.