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

Commit

Permalink
fix: in queue sync datastore to disk
Browse files Browse the repository at this point in the history
  • Loading branch information
aschmahmann committed Apr 9, 2021
1 parent 9eada81 commit c707e99
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions queue/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ 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 @@ -124,13 +130,25 @@ 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 c707e99

Please sign in to comment.