diff --git a/go.mod b/go.mod index 224fb61..b0d22e0 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/ipfs/go-ds-badger2 v0.1.3 github.com/ipfs/go-ds-flatfs v0.5.1 github.com/ipfs/go-ipld-format v0.6.0 - github.com/jackalLabs/canine-chain/v4 v4.1.0 + github.com/jackalLabs/canine-chain/v4 v4.1.1 github.com/json-iterator/go v1.1.12 github.com/libp2p/go-libp2p v0.32.2 github.com/multiformats/go-multiaddr v0.12.3 diff --git a/go.sum b/go.sum index 147a5b6..b54d78f 100644 --- a/go.sum +++ b/go.sum @@ -859,8 +859,8 @@ github.com/iris-contrib/jade v1.1.4/go.mod h1:EDqR+ur9piDl6DUgs6qRrlfzmlx/D5Uybo github.com/iris-contrib/pongo2 v0.0.1/go.mod h1:Ssh+00+3GAZqSQb30AvBRNxBx7rf0GqwkjqxNd0u65g= github.com/iris-contrib/schema v0.0.1/go.mod h1:urYA3uvUNG1TIIjOSCzHr9/LmbQo8LrOcOqfqxa4hXw= github.com/iris-contrib/schema v0.0.6/go.mod h1:iYszG0IOsuIsfzjymw1kMzTL8YQcCWlm65f3wX8J5iA= -github.com/jackalLabs/canine-chain/v4 v4.1.0 h1:3PA7UNn2Nu7HHY+LAnpCMQxg32GyRt+F6ntQTLIve/A= -github.com/jackalLabs/canine-chain/v4 v4.1.0/go.mod h1:td0cUHEvmWwqTA+pS8ItQzZxZqFVx/RGqb8MMgOAq+w= +github.com/jackalLabs/canine-chain/v4 v4.1.1 h1:dUkk9kclOLC2Ku3QjNcnya5B7fo13MWPZEVy6qJ8lF8= +github.com/jackalLabs/canine-chain/v4 v4.1.1/go.mod h1:td0cUHEvmWwqTA+pS8ItQzZxZqFVx/RGqb8MMgOAq+w= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= diff --git a/recycle/recycle.go b/recycle/recycle.go index 3ec547c..382e840 100644 --- a/recycle/recycle.go +++ b/recycle/recycle.go @@ -6,11 +6,14 @@ import ( "fmt" "io" "io/fs" + "math/rand" "os" "path/filepath" "strings" "time" + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/JackalLabs/jackal-provider/jprov/archive" "github.com/jackalLabs/canine-chain/v4/x/storage/types" "github.com/rs/zerolog/log" @@ -174,13 +177,19 @@ func record(file io.Writer, merkle []byte, size int, fid string) error { func (r *RecycleDepot) collectOpenFiles() ([]types.UnifiedFile, error) { req := &types.QueryOpenFiles{ ProviderAddress: r.address, - Pagination: nil, + Pagination: &query.PageRequest{ + Key: nil, + Offset: 0, + Limit: 300, + CountTotal: true, + Reverse: rand.Int63n(2) == 0, + }, } resp, err := r.queryClient.OpenFiles(context.Background(), req) if err != nil { return nil, err } - log.Info().Msgf("We found %d files open", len(resp.Files)) + log.Info().Msgf("We found %d files open", resp.Pagination.Total) return resp.Files, nil }