Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
removed newly added syncs from the provider queue and updated its doc…
Browse files Browse the repository at this point in the history
…umentation
  • Loading branch information
aschmahmann committed May 12, 2021
1 parent 9e61fa1 commit c3fd90b
Showing 1 changed file with 4 additions and 22 deletions.
26 changes: 4 additions & 22 deletions queue/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import (

var log = logging.Logger("provider.queue")

// Queue provides a durable, FIFO interface to the datastore for storing cids
// Queue provides a best-effort durability, FIFO interface to the datastore for storing cids
//
// Durability just means that cids in the process of being provided when a
// crash or shutdown occurs will still be in the queue when the node is
// brought back online.
// Best-effort durability just means that cids in the process of being provided when a
// crash or shutdown occurs may be in the queue when the node is brought back online
// depending on whether the underlying datastore has synchronous or asynchronous writes.
type Queue struct {
// used to differentiate queues in datastore
// e.g. provider vs reprovider
Expand Down Expand Up @@ -102,12 +102,6 @@ func (q *Queue) work() {
log.Errorf("error deleting queue entry with key (%s), due to error (%s), stopping provider", head.Key, err)
return
}

if err := q.ds.Sync(k); err != nil {
log.Errorf("error syncing deletion of queue entry with key (%s), due to error (%s), stopping provider", head.Key, err)
continue
}

continue
}
} else {
Expand All @@ -130,25 +124,13 @@ func (q *Queue) work() {
log.Errorf("Failed to enqueue cid: %s", err)
continue
}

if err := q.ds.Sync(k); err != nil {
log.Errorf("Failed to sync enqueuing cid: %s", err)
continue
}

case dequeue <- c:
err := q.ds.Delete(k)

if err != nil {
log.Errorf("Failed to delete queued cid %s with key %s: %s", c, k, err)
continue
}

if err := q.ds.Sync(k); err != nil {
log.Errorf("Failed to sync deleted queued cid %s with key %s: %s", c, k, err)
continue
}

c = cid.Undef
case <-q.ctx.Done():
return
Expand Down

0 comments on commit c3fd90b

Please sign in to comment.