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 19, 2021
1 parent 4c057eb commit 94c4538
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 94c4538

Please sign in to comment.