fix(storage): delete storage fails if a panic occurred during initialization (#7501)
* fix(storage): store storages map when init storage panic * fix(drivers): add nil check to drop method
This commit is contained in:
parent
c3c5843dce
commit
1c01dc6839
@ -67,7 +67,9 @@ func (d *ChaoXing) Init(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (d *ChaoXing) Drop(ctx context.Context) error {
|
func (d *ChaoXing) Drop(ctx context.Context) error {
|
||||||
d.cron.Stop()
|
if d.cron != nil {
|
||||||
|
d.cron.Stop()
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,9 @@ func (d *Vtencent) Init(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (d *Vtencent) Drop(ctx context.Context) error {
|
func (d *Vtencent) Drop(ctx context.Context) error {
|
||||||
d.cron.Stop()
|
if d.cron != nil {
|
||||||
|
d.cron.Stop()
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ func initStorage(ctx context.Context, storage model.Storage, storageDriver drive
|
|||||||
log.Errorf("panic init storage: %s", errInfo)
|
log.Errorf("panic init storage: %s", errInfo)
|
||||||
driverStorage.SetStatus(errInfo)
|
driverStorage.SetStatus(errInfo)
|
||||||
MustSaveDriverStorage(storageDriver)
|
MustSaveDriverStorage(storageDriver)
|
||||||
storagesMap.Delete(driverStorage.MountPath)
|
storagesMap.Store(driverStorage.MountPath, storageDriver)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
// Unmarshal Addition
|
// Unmarshal Addition
|
||||||
|
Loading…
x
Reference in New Issue
Block a user