Commit 13f94287 authored by Steven Allen's avatar Steven Allen

chore: fix a bunch of issues caught by golangci-lint

Most of these are probably harmless but a few looked like they might actually be
bugs. Most of them are just faulty tests.

License: MIT
Signed-off-by: default avatarSteven Allen <steven@stebalien.com>
parent cb07b212
......@@ -62,11 +62,6 @@ func (q *Queue) Dequeue() <-chan cid.Cid {
return q.dequeue
}
type entry struct {
cid cid.Cid
key datastore.Key
}
// Look for next Cid in the queue and return it. Skip over gaps and mangled data
func (q *Queue) nextEntry() (datastore.Key, cid.Cid) {
for {
......@@ -91,6 +86,9 @@ func (q *Queue) nextEntry() (datastore.Key, cid.Cid) {
log.Warningf("Error marshalling Cid from queue: ", err)
q.head++
err = q.ds.Delete(key)
if err != nil {
log.Warningf("Provider queue failed to delete: %s", key)
}
continue
}
......
......@@ -99,6 +99,9 @@ func TestMangledData(t *testing.T) {
// remove entries in the middle
err = queue.ds.Put(queue.queueKey(5), []byte("borked"))
if err != nil {
t.Fatal(err)
}
expected := append(cids[:5], cids[6:]...)
assertOrdered(expected, queue, t)
......
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