diff options
author | guillep2k <18600385+guillep2k@users.noreply.github.com> | 2020-05-04 03:51:09 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-04 07:51:09 +0100 |
commit | 64029e1468d1c004262088ac7423fac0ba1124b7 (patch) | |
tree | b754c01388c197258fa989fb2a7f23574ad16152 /vendor/gitea.com/lunny/levelqueue/set.go | |
parent | b7c82cd1a9ce4f863034a3a59312ff9402a8f72c (diff) | |
download | gitea-64029e1468d1c004262088ac7423fac0ba1124b7.tar.gz gitea-64029e1468d1c004262088ac7423fac0ba1124b7.zip |
Update lunny/levelqueue to 0.3.0 (#11285)
Co-authored-by: Guillermo Prandi <guillep2k@users.noreply.github.com>
Diffstat (limited to 'vendor/gitea.com/lunny/levelqueue/set.go')
-rw-r--r-- | vendor/gitea.com/lunny/levelqueue/set.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/vendor/gitea.com/lunny/levelqueue/set.go b/vendor/gitea.com/lunny/levelqueue/set.go index 88f4e9b1d1..f5995cb8f1 100644 --- a/vendor/gitea.com/lunny/levelqueue/set.go +++ b/vendor/gitea.com/lunny/levelqueue/set.go @@ -8,6 +8,7 @@ import ( "sync" "github.com/syndtr/goleveldb/leveldb" + "github.com/syndtr/goleveldb/leveldb/errors" "github.com/syndtr/goleveldb/leveldb/util" ) @@ -28,7 +29,13 @@ type Set struct { func OpenSet(dataDir string) (*Set, error) { db, err := leveldb.OpenFile(dataDir, nil) if err != nil { - return nil, err + if !errors.IsCorrupted(err) { + return nil, err + } + db, err = leveldb.RecoverFile(dataDir, nil) + if err != nil { + return nil, err + } } return NewSet(db, []byte(setPrefixStr), true) } |