Unverified Commit de00be34 authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #455 from libp2p/fix/warn-to-error

fix(providers): upgrade warnings to errors
parents 5552b3ff 9f0782bd
...@@ -133,13 +133,13 @@ func loadProvSet(dstore ds.Datastore, k []byte) (*providerSet, error) { ...@@ -133,13 +133,13 @@ func loadProvSet(dstore ds.Datastore, k []byte) (*providerSet, error) {
switch { switch {
case err != nil: case err != nil:
// couldn't parse the time // couldn't parse the time
log.Warning("parsing providers record from disk: ", err) log.Error("parsing providers record from disk: ", err)
fallthrough fallthrough
case now.Sub(t) > ProvideValidity: case now.Sub(t) > ProvideValidity:
// or just expired // or just expired
err = dstore.Delete(ds.RawKey(e.Key)) err = dstore.Delete(ds.RawKey(e.Key))
if err != nil && err != ds.ErrNotFound { if err != nil && err != ds.ErrNotFound {
log.Warning("failed to remove provider record from disk: ", err) log.Error("failed to remove provider record from disk: ", err)
} }
continue continue
} }
...@@ -151,7 +151,7 @@ func loadProvSet(dstore ds.Datastore, k []byte) (*providerSet, error) { ...@@ -151,7 +151,7 @@ func loadProvSet(dstore ds.Datastore, k []byte) (*providerSet, error) {
log.Error("base32 decoding error: ", err) log.Error("base32 decoding error: ", err)
err = dstore.Delete(ds.RawKey(e.Key)) err = dstore.Delete(ds.RawKey(e.Key))
if err != nil && err != ds.ErrNotFound { if err != nil && err != ds.ErrNotFound {
log.Warning("failed to remove provider record from disk: ", err) log.Error("failed to remove provider record from disk: ", err)
} }
continue continue
} }
...@@ -264,13 +264,13 @@ func (pm *ProviderManager) run(proc goprocess.Process) { ...@@ -264,13 +264,13 @@ func (pm *ProviderManager) run(proc goprocess.Process) {
switch { switch {
case err != nil: case err != nil:
// couldn't parse the time // couldn't parse the time
log.Warning("parsing providers record from disk: ", err) log.Error("parsing providers record from disk: ", err)
fallthrough fallthrough
case gcTime.Sub(t) > ProvideValidity: case gcTime.Sub(t) > ProvideValidity:
// or expired // or expired
err = pm.dstore.Delete(ds.RawKey(res.Key)) err = pm.dstore.Delete(ds.RawKey(res.Key))
if err != nil && err != ds.ErrNotFound { if err != nil && err != ds.ErrNotFound {
log.Warning("failed to remove provider record from disk: ", err) log.Error("failed to remove provider record from disk: ", err)
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment