mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-27 09:12:07 +01:00
fix: optimize the mechanism of quota refresh (#18795)
Signed-off-by: chlins <chenyuzh@vmware.com>
This commit is contained in:
parent
8251fd2dec
commit
c08c7c52a0
@ -185,6 +185,13 @@ func (c *controller) updateUsageWithRetry(ctx context.Context, reference, refere
|
||||
return retry.Abort(err)
|
||||
}
|
||||
|
||||
// The PR https://github.com/goharbor/harbor/pull/17392 optimized the logic for post upload blob which use size 0
|
||||
// for checking quota, this will increase the pressure of optimistic lock, so here return earlier
|
||||
// if the quota usage has not changed to reduce the probability of optimistic lock.
|
||||
if types.Equals(used, newUsed) {
|
||||
return nil
|
||||
}
|
||||
|
||||
q.SetUsed(newUsed)
|
||||
|
||||
err = c.quotaMgr.Update(ctx, q)
|
||||
|
Loading…
Reference in New Issue
Block a user