Merge pull request #58 from sgotti/readdb_fix_deadlock
readdb: fix deadlock in Run method
This commit is contained in:
commit
77ee8d9e7d
|
@ -424,7 +424,6 @@ func (r *ReadDB) Run(ctx context.Context) error {
|
||||||
}
|
}
|
||||||
r.SetInitialized(true)
|
r.SetInitialized(true)
|
||||||
|
|
||||||
errCh := make(chan error)
|
|
||||||
for {
|
for {
|
||||||
for {
|
for {
|
||||||
initialized := r.IsInitialized()
|
initialized := r.IsInitialized()
|
||||||
|
@ -441,6 +440,7 @@ func (r *ReadDB) Run(ctx context.Context) error {
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
errCh := make(chan error, 1)
|
||||||
ctx, cancel := context.WithCancel(ctx)
|
ctx, cancel := context.WithCancel(ctx)
|
||||||
wg := &sync.WaitGroup{}
|
wg := &sync.WaitGroup{}
|
||||||
|
|
||||||
|
|
|
@ -274,7 +274,6 @@ func (r *ReadDB) Run(ctx context.Context) error {
|
||||||
}
|
}
|
||||||
r.SetInitialized(true)
|
r.SetInitialized(true)
|
||||||
|
|
||||||
errCh := make(chan error)
|
|
||||||
for {
|
for {
|
||||||
for {
|
for {
|
||||||
initialized := r.IsInitialized()
|
initialized := r.IsInitialized()
|
||||||
|
@ -291,6 +290,7 @@ func (r *ReadDB) Run(ctx context.Context) error {
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
errCh := make(chan error, 2)
|
||||||
ctx, cancel := context.WithCancel(ctx)
|
ctx, cancel := context.WithCancel(ctx)
|
||||||
wg := &sync.WaitGroup{}
|
wg := &sync.WaitGroup{}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue