Skip to content
Snippets Groups Projects
Unverified Commit 570f8ddc authored by Kamil Trzcinski's avatar Kamil Trzcinski
Browse files

Add missing lock on tags

parent 4b666c54
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -2,9 +2,9 @@ package main
 
import (
"path/filepath"
"sync"
 
"github.com/Sirupsen/logrus"
"sync"
)
 
var (
Loading
Loading
Loading
Loading
@@ -2,9 +2,9 @@ package main
 
import (
"flag"
"sync"
 
"github.com/Sirupsen/logrus"
"sync"
)
 
var (
Loading
Loading
Loading
Loading
@@ -4,14 +4,14 @@ import (
"encoding/json"
"fmt"
"path/filepath"
"sync"
 
"github.com/Sirupsen/logrus"
"github.com/docker/distribution"
"github.com/docker/distribution/manifest"
"github.com/docker/distribution/manifest/manifestlist"
"github.com/docker/distribution/manifest/schema1"
"github.com/docker/distribution/manifest/schema2"
"sync"
"github.com/Sirupsen/logrus"
)
 
type manifestData struct {
Loading
Loading
Loading
Loading
@@ -4,9 +4,9 @@ import (
"fmt"
"path/filepath"
"strings"
"sync"
 
"github.com/Sirupsen/logrus"
"sync"
)
 
type repositoryData struct {
Loading
Loading
@@ -15,10 +15,11 @@ type repositoryData struct {
manifests map[string]int
tags map[string]*tag
uploads map[string]int
lock sync.Mutex
lock sync.Mutex
}
 
type repositoriesData map[string]*repositoryData
var repositoriesLock sync.Mutex
 
func newRepositoryData(name string) *repositoryData {
Loading
Loading
@@ -254,8 +255,11 @@ func (r repositoriesData) walk() error {
err := currentStorage.Walk("repositories", func(path string, info fileInfo, err error) error {
jg.Dispatch(func() error {
err = r.process(strings.Split(path, "/"), info)
logrus.Infoln("REPOSITORY:", path, ":", err)
return err
if err != nil {
logrus.Infoln("REPOSITORY:", path, ":", err)
return err
}
return nil
})
return nil
})
Loading
Loading
Loading
Loading
@@ -4,25 +4,25 @@ import (
"errors"
"flag"
"io/ioutil"
"os"
"path/filepath"
"strings"
"os"
"sync/atomic"
 
"github.com/Sirupsen/logrus"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"sync/atomic"
"github.com/Sirupsen/logrus"
)
 
const listMax = 1000
 
type s3Storage struct {
S3 *s3.S3
apiCalls int64
cacheHits int64
S3 *s3.S3
apiCalls int64
cacheHits int64
cacheError int64
cacheMiss int64
cacheMiss int64
}
 
var s3RootDir = flag.String("s3-root-dir", "", "s3 root directory")
Loading
Loading
package main
 
import (
"flag"
"path/filepath"
"sync"
 
"github.com/Sirupsen/logrus"
"flag"
)
 
var deleteOldTagVersions = flag.Bool("delete-old-tag-versions", true, "Delete old tag versions")
Loading
Loading
@@ -14,6 +15,7 @@ type tag struct {
name string
current string
versions []string
lock sync.Mutex
}
 
func (t *tag) currentLinkPath() string {
Loading
Loading
@@ -68,6 +70,9 @@ func (t *tag) addVersion(args []string, info fileInfo) error {
return err
}
 
t.lock.Lock()
defer t.lock.Unlock()
t.versions = append(t.versions, link)
return nil
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment