Skip to content

Commit 7a68c65

Browse files
committed
fix: addressed possible 0-division error
1 parent 1ba9a99 commit 7a68c65

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/DIRAC/AccountingSystem/DB/AccountingDB.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
""" Frontend to MySQL DB AccountingDB
2-
"""
1+
"""Frontend to MySQL DB AccountingDB"""
2+
33
import datetime
44
import random
55
import threading
@@ -531,6 +531,8 @@ def calculateBuckets(self, typeName, startTime, endTime, nowEpoch=False):
531531
return [(currentBucketStart, 1, bucketTimeLength)]
532532
buckets = []
533533
totalLength = endTime - startTime
534+
if totalLength == 0:
535+
return [(currentBucketStart, 1, bucketTimeLength)]
534536
while currentBucketStart < endTime:
535537
start = max(currentBucketStart, startTime)
536538
end = min(currentBucketStart + bucketTimeLength, endTime)

0 commit comments

Comments
 (0)