ResetBootstrapState releases the initialized core app resources (closing db connections, stopping cron ticker, etc.).
()
| 449 | // ResetBootstrapState releases the initialized core app resources |
| 450 | // (closing db connections, stopping cron ticker, etc.). |
| 451 | func (app *BaseApp) ResetBootstrapState() error { |
| 452 | app.Cron().Stop() |
| 453 | |
| 454 | var errs []error |
| 455 | |
| 456 | dbs := []*dbx.Builder{ |
| 457 | &app.concurrentDB, |
| 458 | &app.nonconcurrentDB, |
| 459 | &app.auxConcurrentDB, |
| 460 | &app.auxNonconcurrentDB, |
| 461 | } |
| 462 | |
| 463 | for _, db := range dbs { |
| 464 | if db == nil { |
| 465 | continue |
| 466 | } |
| 467 | if v, ok := (*db).(closer); ok { |
| 468 | if err := v.Close(); err != nil { |
| 469 | errs = append(errs, err) |
| 470 | } |
| 471 | } |
| 472 | *db = nil |
| 473 | } |
| 474 | |
| 475 | if len(errs) > 0 { |
| 476 | return errors.Join(errs...) |
| 477 | } |
| 478 | |
| 479 | return nil |
| 480 | } |
| 481 | |
| 482 | // DB returns the default app data.db builder instance. |
| 483 | // |