redis: Remove v0.7.0 migration (3 years old)
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
be4a0ec91d
commit
900d816dff
1 changed files with 0 additions and 33 deletions
|
@ -7,7 +7,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/gofrs/uuid/v3"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/xuyu/goredis"
|
||||
)
|
||||
|
||||
|
@ -29,41 +28,9 @@ func newStorageRedis() (storage, error) {
|
|||
conn: c,
|
||||
}
|
||||
|
||||
if err := s.migrate(); err != nil { // Move from the old to the new storage format
|
||||
return nil, err
|
||||
}
|
||||
|
||||
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 {
|
||||
var expStr string
|
||||
for _, eVar := range []string{"SECRET_EXPIRY", "REDIS_EXPIRY"} {
|
||||
|
|
Loading…
Reference in a new issue