修改domain包
This commit is contained in:
@@ -57,8 +57,8 @@ func NewApplication(configPath string) (*Application, error) {
|
||||
appServices.deviceService,
|
||||
appServices.planService,
|
||||
appServices.userService,
|
||||
infra.tokenService,
|
||||
appServices.auditService,
|
||||
infra.tokenGenerator,
|
||||
infra.lora.listenHandler,
|
||||
)
|
||||
|
||||
@@ -91,7 +91,7 @@ func (app *Application) Start() error {
|
||||
}
|
||||
|
||||
// 3. 启动后台工作协程
|
||||
app.Domain.planService.Start()
|
||||
app.Domain.planService.Start(startCtx)
|
||||
|
||||
// 4. 启动 API 服务器
|
||||
app.API.Start()
|
||||
@@ -107,14 +107,14 @@ func (app *Application) Start() error {
|
||||
|
||||
// Stop 优雅地关闭应用的所有组件。
|
||||
func (app *Application) Stop() error {
|
||||
logger := logs.TraceLogger(app.Ctx, app.Ctx, "Stop")
|
||||
stopCtx, logger := logs.Trace(app.Ctx, app.Ctx, "Stop")
|
||||
logger.Info("应用关闭中...")
|
||||
|
||||
// 关闭 API 服务器
|
||||
app.API.Stop()
|
||||
|
||||
// 关闭任务执行器
|
||||
app.Domain.planService.Stop()
|
||||
app.Domain.planService.Stop(stopCtx)
|
||||
|
||||
// 断开数据库连接
|
||||
if err := app.Infra.storage.Disconnect(); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user