mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
Merge pull request #442 from kkc/fix_bollmaker_backtest
Fix: fallback to memory persistence if redis not found
This commit is contained in:
commit
e4b4f69716
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/c9s/bbgo/pkg/service"
|
"github.com/c9s/bbgo/pkg/service"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PersistenceSelector struct {
|
type PersistenceSelector struct {
|
||||||
|
@ -27,6 +28,10 @@ func (p *Persistence) backendService(t string) (service.PersistenceService, erro
|
||||||
return p.Facade.Json, nil
|
return p.Facade.Json, nil
|
||||||
|
|
||||||
case "redis":
|
case "redis":
|
||||||
|
if p.Facade.Redis == nil {
|
||||||
|
log.Warn("redis persistence is not available, fallback to memory backend")
|
||||||
|
return p.Facade.Memory, nil
|
||||||
|
}
|
||||||
return p.Facade.Redis, nil
|
return p.Facade.Redis, nil
|
||||||
|
|
||||||
case "memory":
|
case "memory":
|
||||||
|
|
Loading…
Reference in New Issue
Block a user