GODT-1746: wait until frontend is ready

This commit is contained in:
Romain LE JEUNE
2022-07-26 09:27:45 +02:00
committed by Jakub
parent 0a1f349901
commit 2e4128dcfe
2 changed files with 9 additions and 2 deletions

View File

@ -113,6 +113,10 @@ func NewService(
firstTimeAutostart: sync.Once{},
}
// Initializing.Done is only called sync.Once. Please keep the increment
// set to 1
s.initializing.Add(1)
config, err := tls.GetConfig()
config.ClientAuth = cryptotls.NoClientCert // skip client auth if the certificate allow it.
if err != nil {
@ -191,7 +195,9 @@ func (s *Service) NotifySilentUpdateError(err error) {
_ = s.SendEvent(NewUpdateErrorEvent(UpdateErrorType_UPDATE_SILENT_ERROR))
}
func (s *Service) WaitUntilFrontendIsReady() {}
func (s *Service) WaitUntilFrontendIsReady() {
s.initializing.Wait()
}
func (s *Service) watchEvents() { // nolint:funlen
if s.bridge.HasError(bridge.ErrLocalCacheUnavailable) {

View File

@ -69,7 +69,8 @@ func (s *Service) AddLogEntry(_ context.Context, request *AddLogEntryRequest) (*
// GuiReady implement the GuiReady gRPC service call.
func (s *Service) GuiReady(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
s.log.Info("GuiReady")
// Note nothing to be done. old Qt frontend had a sync.one
// sync.one
s.initializationDone.Do(s.initializing.Done)
return &emptypb.Empty{}, nil
}