@@ -79,7 +79,7 @@ func getShutdownHelper(a actionImpl) (ActionCore, api.MemberStatus, bool) {
7979 }
8080
8181 if features .GracefulShutdown ().Enabled () {
82- return shutdownHelperAPI { actionImpl : a , memberStatus : m } , m , true
82+ return getShutdownHelperAPI ( a , m ) , m , true
8383 }
8484
8585 serverGroup := a .actionCtx .GetSpec ().GetServerGroupSpec (a .action .Group )
@@ -88,10 +88,40 @@ func getShutdownHelper(a actionImpl) (ActionCore, api.MemberStatus, bool) {
8888 case api .ServerGroupShutdownMethodDelete :
8989 return shutdownHelperDelete {actionImpl : a , memberStatus : m }, m , true
9090 default :
91- return shutdownHelperAPI { actionImpl : a , memberStatus : m } , m , true
91+ return getShutdownHelperAPI ( a , m ) , m , true
9292 }
9393}
9494
95+ func getShutdownHelperAPI (a actionImpl , member api.MemberStatus ) ActionCore {
96+ act := shutdownHelperAPI {actionImpl : a , memberStatus : member }
97+
98+ if ! features .OptionalGracefulShutdown ().Enabled () {
99+ return act
100+ }
101+
102+ return shutdownHelperOptionalAPI {action : act }
103+ }
104+
105+ type shutdownHelperOptionalAPI struct {
106+ action shutdownHelperAPI
107+ }
108+
109+ func (s shutdownHelperOptionalAPI ) Start (ctx context.Context ) (bool , error ) {
110+ return false , nil
111+ }
112+
113+ func (s shutdownHelperOptionalAPI ) CheckProgress (ctx context.Context ) (bool , bool , error ) {
114+ if done , abort , err := s .action .CheckProgress (ctx ); err != nil || abort || done {
115+ return done , abort , err
116+ }
117+
118+ if _ , err := s .action .Start (ctx ); err != nil {
119+ return false , false , nil
120+ }
121+
122+ return false , false , nil
123+ }
124+
95125type shutdownHelperAPI struct {
96126 actionImpl
97127 memberStatus api.MemberStatus
0 commit comments