package serverimp

import (
	"context"
	"time"
)

func (i *Imp) shutdownApp() {
	if i.app != nil {
		timeout := 15 * time.Second
		if i.config != nil && i.config.Runtime != nil {
			timeout = i.config.Runtime.ShutdownTimeout()
		}
		ctx, cancel := context.WithTimeout(context.Background(), timeout)
		i.app.Shutdown(ctx)
		cancel()
	}
}
