From cd85edd64d354699d5bfcdbdc582014f9ecb9570 Mon Sep 17 00:00:00 2001 From: Kakashi Liu Date: Fri, 21 Jan 2022 23:28:51 +0800 Subject: [PATCH] Fix: fallback to memory persistence if redis not found resolve #438 Fix bollmaker backtest error --- pkg/bbgo/persistence.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/bbgo/persistence.go b/pkg/bbgo/persistence.go index 8f8e45e81..665813b35 100644 --- a/pkg/bbgo/persistence.go +++ b/pkg/bbgo/persistence.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/c9s/bbgo/pkg/service" + log "github.com/sirupsen/logrus" ) type PersistenceSelector struct { @@ -27,6 +28,10 @@ func (p *Persistence) backendService(t string) (service.PersistenceService, erro return p.Facade.Json, nil 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 case "memory":