Skip to content

Commit

Permalink
boot state
Browse files Browse the repository at this point in the history
  • Loading branch information
davidebianchi committed Oct 24, 2024
1 parent 858753d commit 29d82fa
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions service/sdkbootstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ type SDKBootState struct {
mtx *sync.Mutex
rond sdk.OASEvaluatorFinder

ch chan bool
ch chan bool
isReady bool
}

func NewSDKBootState() *SDKBootState {
Expand All @@ -35,6 +36,7 @@ func (s *SDKBootState) Ready(rond sdk.OASEvaluatorFinder) {
s.mtx.Lock()
defer s.mtx.Unlock()
s.rond = rond
s.isReady = true
if s.ch != nil {
s.ch <- true
close(s.ch)
Expand All @@ -51,7 +53,7 @@ func (s *SDKBootState) Get() sdk.OASEvaluatorFinder {
func (s *SDKBootState) IsReady() bool {
s.mtx.Lock()
defer s.mtx.Unlock()
return s.rond != nil
return s.isReady
}

func (s *SDKBootState) IsReadyChan() chan bool {
Expand All @@ -60,7 +62,7 @@ func (s *SDKBootState) IsReadyChan() chan bool {
if s.ch != nil {
return s.ch
}
if s.rond != nil {
if s.isReady {
ch := make(chan bool)
go func() {
ch <- true
Expand Down

0 comments on commit 29d82fa

Please sign in to comment.