This commit is contained in:
2026-08-14 16:34:17 +08:00
parent e0b0e1d8c8
commit f63acae353
53 changed files with 2488 additions and 350 deletions
+12
View File
@@ -160,6 +160,14 @@ func (d *Data) reloadConfig(ctx context.Context) error {
}
useRedis := next.Admin.System != nil && next.Admin.System.UseRedis
candidateRedis := openRedis(next.Data.Redis, useRedis)
useMongo := next.Admin.System != nil && next.Admin.System.UseMongo
candidateMongo, mongoErr := openMongo(next.Data.Mongo, useMongo)
mongoAccepted := false
defer func() {
if !mongoAccepted && candidateMongo != nil {
_ = candidateMongo.Disconnect(context.Background())
}
}()
candidateDBList, err := openDatabaseList(next.Data.DatabaseList)
if err != nil {
return err
@@ -168,6 +176,10 @@ func (d *Data) reloadConfig(ctx context.Context) error {
d.gormDB.replace(candidateDB)
d.replaceDatabaseList(candidateDBList)
d.redis.replace(candidateRedis)
if mongoErr == nil {
d.mongo.replace(candidateMongo)
mongoAccepted = true
}
d.runtime.Replace(next.Data, next.Admin)
if d.storage != nil {
d.storage.replace(candidateStorage)