@@ -125,6 +125,30 @@ func NewService(
|
|||||||
return svc, nil
|
return svc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Service) Run(ctx context.Context) error {
|
||||||
|
runCtx, stopAll := context.WithCancel(ctx)
|
||||||
|
defer stopAll()
|
||||||
|
|
||||||
|
errCh := make(chan error, 1)
|
||||||
|
go func() {
|
||||||
|
errCh <- s.SAMLService.Run(runCtx)
|
||||||
|
}()
|
||||||
|
|
||||||
|
select {
|
||||||
|
case <-ctx.Done():
|
||||||
|
stopAll()
|
||||||
|
<-errCh
|
||||||
|
return ctx.Err()
|
||||||
|
case err := <-errCh:
|
||||||
|
if err != nil {
|
||||||
|
s.logger.ErrorCtx(ctx, "iam service failed", log.Error(err))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Service) GetMembership(ctx context.Context, membershipID gid.GID) (*coredata.Membership, error) {
|
func (s *Service) GetMembership(ctx context.Context, membershipID gid.GID) (*coredata.Membership, error) {
|
||||||
var (
|
var (
|
||||||
scope = coredata.NewScopeFromObjectID(membershipID)
|
scope = coredata.NewScopeFromObjectID(membershipID)
|
||||||
|
|||||||
@@ -491,14 +491,14 @@ func (impl *Implm) Run(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
samlServiceCtx, stopSAMLService := context.WithCancel(context.Background())
|
iamServiceCtx, stopIAMService := context.WithCancel(context.Background())
|
||||||
wg.Go(
|
wg.Go(
|
||||||
func() {
|
func() {
|
||||||
if iamService.SAMLService != nil {
|
|
||||||
if err := iamService.SAMLService.Run(samlServiceCtx); err != nil {
|
if err := iamService.Run(iamServiceCtx); err != nil {
|
||||||
cancel(fmt.Errorf("saml service crashed: %w", err))
|
cancel(fmt.Errorf("iam service crashed: %w", err))
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -517,7 +517,7 @@ func (impl *Implm) Run(
|
|||||||
stopMailer()
|
stopMailer()
|
||||||
stopSlackSender()
|
stopSlackSender()
|
||||||
stopExportJobExporter()
|
stopExportJobExporter()
|
||||||
stopSAMLService()
|
stopIAMService()
|
||||||
stopApiServer()
|
stopApiServer()
|
||||||
stopTrustCenterServer()
|
stopTrustCenterServer()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user