func (wh *WorkflowHandler) DescribeDomain(
	ctx context.Context,
	describeRequest *types.DescribeDomainRequest,
) (response *types.DescribeDomainResponse, retError error) {
	defer log.CapturePanic(wh.GetLogger(), &retError)

	scope, sw := wh.startRequestProfile(ctx, metrics.FrontendDescribeDomainScope)
	defer sw.Stop()

	if wh.isShuttingDown() {
		return nil, errShuttingDown
	}

	if err := wh.versionChecker.ClientSupported(ctx, wh.config.EnableClientVersionCheck()); err != nil {
		return nil, wh.error(err, scope)
	}

	if describeRequest == nil {
		return nil, errRequestNotSet
	}

	if describeRequest.GetName() == "" && describeRequest.GetUUID() == "" {
		return nil, errDomainNotSet
	}

	resp, err := wh.domainHandler.DescribeDomain(ctx, describeRequest)
	if err != nil {
		return resp, wh.error(err, scope)
	}

	if resp.GetFailoverInfo() != nil && resp.GetFailoverInfo().GetFailoverExpireTimestamp() > 0 {
		// fetch ongoing failover info from history service
		failoverResp, err := wh.GetHistoryClient().GetFailoverInfo(ctx, &types.GetFailoverInfoRequest{
			DomainID: resp.GetDomainInfo().UUID,
		})
		if err != nil {
			// despite the error from history, return describe domain response
			wh.GetLogger().Error(
				fmt.Sprintf("Failed to get failover info for domain %s", resp.DomainInfo.GetName()),
				tag.Error(err),
			)
			return resp, nil
		}
		resp.FailoverInfo.CompletedShardCount = failoverResp.GetCompletedShardCount()
		resp.FailoverInfo.PendingShards = failoverResp.GetPendingShards()
	}
	return resp, err
}
// DescribeDomain returns the information and configuration for a registered domain.
DescribeDomain returns the information and configuration for a registered domain.
// DescribeDomain returns the information and configuration for a registered domain .
func (wh *WorkflowHandler) DescribeDomain(
	ctx context.Context,
	describeRequest *types.DescribeDomainRequest,
) (response *types.DescribeDomainResponse, retError error) {
	defer log.CapturePanic(wh.GetLogger(), &retError)
	scope, sw := wh.startRequestProfile(ctx, metrics.FrontendDescribeDomainScope)
	defer sw.Stop()
	if wh.isShuttingDown() {
		return nil, errShuttingDown
	}
	if err := wh.versionChecker.ClientSupported(ctx, wh.config.EnableClientVersionCheck()); err != nil {
		return nil, wh.error(err, scope)
	}
	if describeRequest == nil {
		return nil, errRequestNotSet
	}
	if describeRequest.GetName() == "" && describeRequest.GetUUID() == "" {
		return nil, errDomainNotSet
	}
	resp, err := wh.domainHandler.DescribeDomain(ctx, describeRequest)
	if err != nil {
		return resp, wh.error(err, scope)
	}
	if resp.GetFailoverInfo() != nil && resp.GetFailoverInfo().GetFailoverExpireTimestamp() > 0 {
		failoverResp, err := wh.GetHistoryClient().GetFailoverInfo(ctx, &types.GetFailoverInfoRequest{
			DomainID: resp.GetDomainInfo().UUID,
		})
		if err != nil {
			wh.GetLogger().Error(
				fmt.Sprintf("Failed to get failover info for domain %s", resp.DomainInfo.GetName()),
				tag.Error(err),
			)
			return resp, nil
		}
		resp.FailoverInfo.CompletedShardCount = failoverResp.GetCompletedShardCount()
		resp.FailoverInfo.PendingShards = failoverResp.GetPendingShards()
	}
	return resp, err
}
func ( wh * WorkflowHandler ) DescribeDomain ( ctx context . Context , describeRequest * types . DescribeDomainRequest , ) ( response * types . DescribeDomainResponse , retError error ) { defer log . CapturePanic ( wh . GetLogger ( ) , & retError ) scope , sw := wh . startRequestProfile ( ctx , metrics . FrontendDescribeDomainScope ) defer sw . Stop ( ) if wh . isShuttingDown ( ) { return nil , errShuttingDown } if err := wh . versionChecker . ClientSupported ( ctx , wh . config . EnableClientVersionCheck ( ) ) ; err != nil { return nil , wh . error ( err , scope ) } if describeRequest == nil { return nil , errRequestNotSet } if describeRequest . GetName ( ) == " " && describeRequest . GetUUID ( ) == " " { return nil , errDomainNotSet } resp , err := wh . domainHandler . DescribeDomain ( ctx , describeRequest ) if err != nil { return resp , wh . error ( err , scope ) } if resp . GetFailoverInfo ( ) != nil && resp . GetFailoverInfo ( ) . GetFailoverExpireTimestamp ( ) > 0 { failoverResp , err := wh . GetHistoryClient ( ) . GetFailoverInfo ( ctx , & types . GetFailoverInfoRequest { DomainID : resp . GetDomainInfo ( ) . UUID , } ) if err != nil { wh . GetLogger ( ) . Error ( fmt . Sprintf ( " " , resp . DomainInfo . GetName ( ) ) , tag . Error ( err ) , ) return resp , nil } resp . FailoverInfo . CompletedShardCount = failoverResp . GetCompletedShardCount ( ) resp . FailoverInfo . PendingShards = failoverResp . GetPendingShards ( ) } return resp , err }
DescribeDomain returns the information and configuration for a registered domain.
DescribeDomain returns the information and configuration for a registered domain .
// fetch ongoing failover info from history service // despite the error from history, return describe domain response