Skip to content

Commit

Permalink
fix for computesize
Browse files Browse the repository at this point in the history
  • Loading branch information
proycon committed Aug 21, 2019
1 parent a6c4031 commit 8d58dbf
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions clam/clamservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,11 +627,19 @@ def getdiskusage(user, project):
path = settings.ROOT + "projects/" + user + '/' + project + "/"
if os.path.exists(os.path.join(path,'.du')):
with open(os.path.join(path,'.du'),'r') as f:
return float(f.read().strip())
size = 0.0
count = 0
for i, line in enumerate(f):
if line == 0:
size = float(line.strip())
elif line == 1:
count = int(line.strip())
return size, count
else:
size, count = computediskusage(path)
with open(os.path.join(path,'.du'),'w') as f:
f.write(str(size))
f.write(str(size) + "\n")
f.write(str(count))
return size, count

@staticmethod
Expand Down

0 comments on commit 8d58dbf

Please sign in to comment.