Skip to content

Commit

Permalink
Properly initialize reload health
Browse files Browse the repository at this point in the history
  • Loading branch information
dchoi-viant committed Mar 29, 2023
1 parent 66b6a42 commit e0c3830
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ func (s *Service) reloadIfNeeded(ctx context.Context) error {
s.dictionary = dictionary
s.inputs = inputs
s.config.Modified = snapshot

atomic.StoreInt32(&s.ReloadOK, 1)

return nil
}

Expand Down Expand Up @@ -429,8 +432,6 @@ func (s *Service) scheduleModelReload() {
if err := s.reloadIfNeeded(context.Background()); err != nil {
fmt.Printf("failed to reload model: %v, due to %v", s.config.ID, err)
atomic.StoreInt32(&s.ReloadOK, 0)
} else {
atomic.StoreInt32(&s.ReloadOK, 1)
}

if atomic.LoadInt32(&s.closed) != 0 {
Expand Down

0 comments on commit e0c3830

Please sign in to comment.