Skip to content

Commit b5067e6

Browse files
authored
Merge pull request #8363 from atsareg/fix-monitoring-cycle
[9.0] Avoid endless loop in MonitoringReporter
2 parents e189963 + 59f83b3 commit b5067e6

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/DIRAC/MonitoringSystem/Client/MonitoringReporter.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ def commit(self):
134134
self.__documents = []
135135
self.__documentLock.release()
136136
recordSent = 0
137+
try_count = 0
137138
try:
138139
while documents:
139140
recordsToSend = documents[: self.__maxRecordsInABundle]
@@ -150,8 +151,13 @@ def commit(self):
150151
# if we managed to publish the records we can delete from the list
151152
recordSent += len(recordsToSend)
152153
del documents[: self.__maxRecordsInABundle]
154+
try_count = 0
153155
else:
154156
gLogger.warn("Failed to insert the records:", retVal["Message"])
157+
try_count += 1
158+
if try_count == 10:
159+
gLogger.error("Failed to insert Monitoring records after 10 attempts")
160+
break
155161
except Exception as e: # pylint: disable=broad-except
156162
gLogger.exception("Error committing", lException=e)
157163
return S_ERROR(f"Error committing {repr(e).replace(',)',')')}")

0 commit comments

Comments
 (0)