Skip to content

Commit

Permalink
Merge pull request #3261 from alexcb/acb/skip-metadata-update-on-empt…
Browse files Browse the repository at this point in the history
…y-queue

Skip boltdb update call when queue is empty
  • Loading branch information
tonistiigi committed Nov 8, 2022
2 parents 5b7315c + 0bb8505 commit a5263dd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cache/metadata/metadata.go
Expand Up @@ -317,6 +317,9 @@ func (s *StorageItem) Queue(fn func(b *bolt.Bucket) error) {
func (s *StorageItem) Commit() error {
s.qmu.Lock()
defer s.qmu.Unlock()
if len(s.queue) == 0 {
return nil
}
return errors.WithStack(s.Update(func(b *bolt.Bucket) error {
for _, fn := range s.queue {
if err := fn(b); err != nil {
Expand Down

0 comments on commit a5263dd

Please sign in to comment.