mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 01:01:56 +00:00
bbgo: configure persistence facade into the isolation context
This commit is contained in:
parent
673304bcf1
commit
e92219194f
|
@ -15,7 +15,7 @@ func BootstrapEnvironmentLightweight(ctx context.Context, environ *Environment,
|
|||
}
|
||||
|
||||
if userConfig.Persistence != nil {
|
||||
if err := ConfigurePersistence(userConfig.Persistence); err != nil {
|
||||
if err := ConfigurePersistence(ctx, userConfig.Persistence); err != nil {
|
||||
return errors.Wrap(err, "persistence configure error")
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ func BootstrapEnvironment(ctx context.Context, environ *Environment, userConfig
|
|||
}
|
||||
|
||||
if userConfig.Persistence != nil {
|
||||
if err := ConfigurePersistence(userConfig.Persistence); err != nil {
|
||||
if err := ConfigurePersistence(ctx, userConfig.Persistence); err != nil {
|
||||
return errors.Wrap(err, "persistence configure error")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,12 +102,15 @@ func NewPersistenceServiceFacade(conf *PersistenceConfig) (*service.PersistenceS
|
|||
return facade, nil
|
||||
}
|
||||
|
||||
func ConfigurePersistence(conf *PersistenceConfig) error {
|
||||
func ConfigurePersistence(ctx context.Context, conf *PersistenceConfig) error {
|
||||
facade, err := NewPersistenceServiceFacade(conf)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
isolation := GetIsolationFromContext(ctx)
|
||||
isolation.persistenceServiceFacade = facade
|
||||
|
||||
persistenceServiceFacade = facade
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user