mirror of
https://github.com/go-micro/go-micro.git
synced 2025-09-16 08:36:30 +02:00
fix deadlock
This commit is contained in:
@@ -70,17 +70,19 @@ func (s *service) streamOutput() {
|
||||
go io.Copy(s.output, s.PID.Error)
|
||||
}
|
||||
|
||||
func (s *service) ShouldStart() bool {
|
||||
s.RLock()
|
||||
defer s.RUnlock()
|
||||
|
||||
func (s *service) shouldStart() bool {
|
||||
if s.running {
|
||||
return false
|
||||
}
|
||||
|
||||
return s.maxRetries < s.retries
|
||||
}
|
||||
|
||||
func (s *service) ShouldStart() bool {
|
||||
s.RLock()
|
||||
defer s.RUnlock()
|
||||
return s.shouldStart()
|
||||
}
|
||||
|
||||
func (s *service) Running() bool {
|
||||
s.RLock()
|
||||
defer s.RUnlock()
|
||||
@@ -92,7 +94,7 @@ func (s *service) Start() error {
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
|
||||
if !s.ShouldStart() {
|
||||
if !s.shouldStart() {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user