redis: Remove v0.7.0 migration (3 years old)

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2023-06-10 00:59:22 +02:00
parent be4a0ec91d
commit 900d816dff
Signed by: luzifer
GPG key ID: D91C3E91E4CAD6F5

View file

@ -7,7 +7,6 @@ import (
"strings" "strings"
"github.com/gofrs/uuid/v3" "github.com/gofrs/uuid/v3"
log "github.com/sirupsen/logrus"
"github.com/xuyu/goredis" "github.com/xuyu/goredis"
) )
@ -29,41 +28,9 @@ func newStorageRedis() (storage, error) {
conn: c, conn: c,
} }
if err := s.migrate(); err != nil { // Move from the old to the new storage format
return nil, err
}
return s, nil return s, nil
} }
func (s storageRedis) migrate() error {
t, err := s.conn.Type(s.redisKey())
if err != nil {
return err
}
log.Printf("Key %q type: %s", s.redisKey(), t)
if t == "hash" {
hashs, err := s.conn.HGetAll(s.redisKey())
if err != nil {
return err
}
for k, v := range hashs {
if err := s.writeKey(k, v); err != nil {
return err
}
}
if _, err = s.conn.Del(s.redisKey()); err != nil {
return err
}
}
return nil
}
func (s storageRedis) redisExpiry() int { func (s storageRedis) redisExpiry() int {
var expStr string var expStr string
for _, eVar := range []string{"SECRET_EXPIRY", "REDIS_EXPIRY"} { for _, eVar := range []string{"SECRET_EXPIRY", "REDIS_EXPIRY"} {