优化结构

This commit is contained in:
Yvan
2026-08-24 17:03:46 +08:00
parent acaee94858
commit 7643152c1e
15 changed files with 244 additions and 203 deletions
+11
View File
@@ -36,6 +36,17 @@ func (r *reloadableMongo) replace(client *mongo.Client) {
}
r.mu.Unlock()
}
func (r *reloadableMongo) load() *mongo.Client {
if r == nil {
return nil
}
r.mu.RLock()
client := r.current
r.mu.RUnlock()
return client
}
func (r *reloadableMongo) close() {
r.mu.Lock()
all := append([]*mongo.Client{r.current}, r.retired...)