Skip to content

Commit

Permalink
Avoid collisions by appending cid
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelavila committed Jul 2, 2019
1 parent b10e389 commit 2ef67c9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion provider/queue/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ func (q *Queue) work() {

select {
case toQueue := <-q.enqueue:
nextKey := datastore.NewKey(fmt.Sprintf("%d", time.Now().UnixNano()))
keyPath := fmt.Sprintf("%d/%s", time.Now().UnixNano(), c.String())
nextKey := datastore.NewKey(keyPath)

if err := q.ds.Put(nextKey, toQueue.Bytes()); err != nil {
log.Errorf("Failed to enqueue cid: %s", err)
Expand Down

0 comments on commit 2ef67c9

Please sign in to comment.