Skip to content

Commit

Permalink
fix: ported out of the inner cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
fstagni committed Jan 20, 2021
1 parent b24476f commit 9e564c8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/DIRAC/ResourceStatusSystem/Agent/SummarizeLogsAgent.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ def execute(self):
self.log.error(deleteResult['Message'])
continue

if self.months:
self._removeOldHistoryEntries(element, self.months)
if self.months:
self._removeOldHistoryEntries(element, self.months)

return S_OK()

Expand Down Expand Up @@ -252,6 +252,7 @@ def _removeOldHistoryEntries(self, element, months):
:return: S_OK / S_ERROR
"""
toRemove = datetime.utcnow().replace(microsecond=0) - timedelta(days=30 * months)
self.log.info("Removing history entries", "older than %s" % toRemove)

deleteResult = self.rsClient.deleteStatusElement(element, 'History',
meta={'older': ['DateEffective', toRemove]})
Expand Down

0 comments on commit 9e564c8

Please sign in to comment.