pull: do not send duplicate status for completed jobs

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
docker-18.09
Tonis Tiigi 2018-07-03 12:14:09 -07:00
parent 0f20a37814
commit e1471c5682
1 changed files with 6 additions and 6 deletions

View File

@ -296,7 +296,7 @@ func getLayers(ctx context.Context, provider content.Provider, desc ocispec.Desc
func showProgress(ctx context.Context, ongoing *jobs, cs content.Store) {
var (
ticker = time.NewTicker(100 * time.Millisecond)
ticker = time.NewTicker(150 * time.Millisecond)
statuses = map[string]statusInfo{}
done bool
)
@ -395,7 +395,7 @@ func showProgress(ctx context.Context, ongoing *jobs, cs content.Store) {
// featured.
type jobs struct {
name string
added map[digest.Digest]job
added map[digest.Digest]*job
mu sync.Mutex
resolved bool
}
@ -409,7 +409,7 @@ type job struct {
func newJobs(name string) *jobs {
return &jobs{
name: name,
added: make(map[digest.Digest]job),
added: make(map[digest.Digest]*job),
}
}
@ -420,7 +420,7 @@ func (j *jobs) add(desc ocispec.Descriptor) {
if _, ok := j.added[desc.Digest]; ok {
return
}
j.added[desc.Digest] = job{
j.added[desc.Digest] = &job{
Descriptor: desc,
started: time.Now(),
}
@ -433,11 +433,11 @@ func (j *jobs) remove(desc ocispec.Descriptor) {
delete(j.added, desc.Digest)
}
func (j *jobs) jobs() []job {
func (j *jobs) jobs() []*job {
j.mu.Lock()
defer j.mu.Unlock()
descs := make([]job, 0, len(j.added))
descs := make([]*job, 0, len(j.added))
for _, j := range j.added {
descs = append(descs, j)
}