restic: Test progress reporting of StreamTrees

This commit is contained in:
Michael Eischer authored and Alexander Neumann committed 2021-01-28 11:10:50 +01:00
1 parent 313ad0e32f
commit ddb7697d29
2 files changed
+46 -4

No files matched your search

+4 -3
View File
@@ -82,7 +82,8 @@ func (c *Counter) Done() {
*c = Counter{} // Prevent reuse.
}
func (c *Counter) get() uint64 {
// Get the current Counter value. This method is concurrency-safe.
func (c *Counter) Get() uint64 {
c.valueMutex.Lock()
v := c.value
c.valueMutex.Unlock()
@@ -102,7 +103,7 @@ func (c *Counter) run() {
defer close(c.stopped)
defer func() {
// Must be a func so that time.Since isn't called at defer time.
c.report(c.get(), c.getMax(), time.Since(c.start), true)
c.report(c.Get(), c.getMax(), time.Since(c.start), true)
}()
var tick <-chan time.Time
@@ -122,6 +123,6 @@ func (c *Counter) run() {
return
}
c.report(c.get(), c.getMax(), now.Sub(c.start), false)
c.report(c.Get(), c.getMax(), now.Sub(c.start), false)
}
}