Skip to content

Commit

Permalink
Merge pull request ipfs/go-ipfs-provider#36 from ipfs/web3-bot/sync
Browse files Browse the repository at this point in the history
sync: update CI config files

This commit was moved from ipfs/go-ipfs-provider@7a606d0
  • Loading branch information
Jorropo authored Dec 9, 2022
2 parents 65758c3 + 02df822 commit 5341e61
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions provider/offline.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package provider

import (
"context"

"github.com/ipfs/go-cid"
)

Expand Down
1 change: 1 addition & 0 deletions provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package provider

import (
"context"

"github.com/ipfs/go-cid"
)

Expand Down
7 changes: 4 additions & 3 deletions provider/queue/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package queue
import (
"context"
"fmt"
"time"

cid "github.com/ipfs/go-cid"
datastore "github.com/ipfs/go-datastore"
namespace "github.com/ipfs/go-datastore/namespace"
Expand All @@ -29,6 +27,8 @@ type Queue struct {
enqueue chan cid.Cid
close context.CancelFunc
closed chan struct{}

counter int
}

// NewQueue creates a queue for cids
Expand Down Expand Up @@ -117,7 +117,8 @@ func (q *Queue) work() {

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

if err := q.ds.Put(q.ctx, nextKey, toQueue.Bytes()); err != nil {
Expand Down
8 changes: 8 additions & 0 deletions provider/simple/reprovide_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ func testReprovide(t *testing.T, trigger func(r *Reprovider, ctx context.Context
maxProvs := 100

for _, c := range nodes {
// We provide raw cids because of the multihash keying
// FIXME(@Jorropo): I think this change should be done in the DHT layer, probably an issue with our routing mock.
b := c.Bytes()
b[1] = 0x55 // rewrite the cid to raw
_, c, err := cid.CidFromBytes(b)
if err != nil {
t.Fatal(err)
}
provChan := clB.FindProvidersAsync(ctx, c, maxProvs)
for p := range provChan {
providers = append(providers, p)
Expand Down
1 change: 1 addition & 0 deletions provider/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package provider

import (
"context"

"github.com/ipfs/go-cid"
)

Expand Down

0 comments on commit 5341e61

Please sign in to comment.