From c8d5410936aaa593a2a108fce4e7da6912ce4d47 Mon Sep 17 00:00:00 2001 From: Caj Larsson Date: Fri, 6 May 2022 21:06:05 +0800 Subject: [PATCH] Fix service usage of new stats --- dataswamp/services.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dataswamp/services.go b/dataswamp/services.go index c9ea65e..27ae628 100644 --- a/dataswamp/services.go +++ b/dataswamp/services.go @@ -38,7 +38,9 @@ func (s SwampFileService) getOrCreateNs(namespace_in string) *namespace.Namespac time.Now(), s.default_allowance_duration, namespace.FileSizeQuota{s.default_allowance_bytes, 0}, - namespace.Usage{0, 0, 0, 0, 0}, + namespace.FileStat{0, 0}, + namespace.FileStat{0, 0}, + namespace.FileStat{0, 0}, } created_ns, err := s.namespace_repo.Create(new_ns) @@ -93,7 +95,8 @@ func (s SwampFileService) SaveFile(ref swampfile.FileReference, src io.Reader, s f.Close() ns.FileQuota.Add(size) - ns.Usage = ns.Usage.Downloaded(size) + ns.Usage = ns.Usage.Add(size) + ns.Upload = ns.Upload.Add(size) s.namespace_repo.Update(ns.ID, *ns) return nil