Skip to content

Commit e8346fd

Browse files
authored
Merge pull request #145 from ludanfeng/main
add shutdown function for boot used by non-web app
2 parents 87c9d49 + 014a6a8 commit e8346fd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

boot.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ func (boot *Boot) Bootstrap(ctx context.Context) {
183183
func (boot *Boot) WaitForShutdownSig(ctx context.Context) {
184184
rkentry.GlobalAppCtx.WaitForShutdownSig()
185185

186+
boot.Shutdown(ctx)
187+
}
188+
189+
// Shutdown shutdown boot. for non-web application
190+
// 1: Call shutdown hook function added by user.
191+
// 2: Call interrupt function of entries in rkentry.GlobalAppCtx.
192+
func (boot *Boot) Shutdown(ctx context.Context) {
186193
// Call shutdown hook function
187194
for _, f := range rkentry.GlobalAppCtx.ListShutdownHooks() {
188195
f()

0 commit comments

Comments
 (0)