@cryptotaxi247 / kubo / commits / 2ef67c973

Avoid collisions by appending cid

Michael Avila committed Jul 2, 2019 at 09:50 UTC 2ef67c97319f8669362305349d8c818542de26d3
1 file changed +2 -1
provider/queue/queue.go
+2 -1
@@ -110,7 +110,8 @@ func (q *Queue) work() {
110
111 select {
112 case toQueue := <-q.enqueue:
113 - nextKey := datastore.NewKey(fmt.Sprintf("%d", time.Now().UnixNano()))
113 + keyPath := fmt.Sprintf("%d/%s", time.Now().UnixNano(), c.String())
114 + nextKey := datastore.NewKey(keyPath)
115
116 if err := q.ds.Put(nextKey, toQueue.Bytes()); err != nil {
117 log.Errorf("Failed to enqueue cid: %s", err)