Skip to content

Commit

Permalink
Merge pull request agola-io#58 from sgotti/readdb_fix_deadlock
Browse files Browse the repository at this point in the history
readdb: fix deadlock in Run method
  • Loading branch information
sgotti authored Jul 23, 2019
2 parents 5973505 + 6d541cd commit f268eca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/services/configstore/readdb/readdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ func (r *ReadDB) Run(ctx context.Context) error {
}
r.SetInitialized(true)

errCh := make(chan error)
for {
for {
initialized := r.IsInitialized()
Expand All @@ -441,6 +440,7 @@ func (r *ReadDB) Run(ctx context.Context) error {
time.Sleep(1 * time.Second)
}

errCh := make(chan error, 1)
ctx, cancel := context.WithCancel(ctx)
wg := &sync.WaitGroup{}

Expand Down
2 changes: 1 addition & 1 deletion internal/services/runservice/readdb/readdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ func (r *ReadDB) Run(ctx context.Context) error {
}
r.SetInitialized(true)

errCh := make(chan error)
for {
for {
initialized := r.IsInitialized()
Expand All @@ -291,6 +290,7 @@ func (r *ReadDB) Run(ctx context.Context) error {
time.Sleep(1 * time.Second)
}

errCh := make(chan error, 2)
ctx, cancel := context.WithCancel(ctx)
wg := &sync.WaitGroup{}

Expand Down

0 comments on commit f268eca

Please # to comment.