Skip to content

Commit

Permalink
Fix provider/location resolver using incorrect cache time
Browse files Browse the repository at this point in the history
  • Loading branch information
xinaxu committed Jul 22, 2023
1 parent 8452f1d commit f74a47a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions integration/filplus/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package main

import (
"context"
"time"

"github.com/data-preservation-programs/RetrievalBot/integration/filplus/util"
"github.com/data-preservation-programs/RetrievalBot/pkg/env"
"github.com/data-preservation-programs/RetrievalBot/pkg/model"
Expand All @@ -13,7 +15,6 @@ import (
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"time"
)

var logger = logging.Logger("filplus-integration")
Expand Down Expand Up @@ -109,11 +110,11 @@ func NewFilPlusIntegration() *FilPlusIntegration {
batchSize := env.GetInt(env.FilplusIntegrationBatchSize, 100)
providerCacheTTL := env.GetDuration(env.ProviderCacheTTL, 24*time.Hour)
locationCacheTTL := env.GetDuration(env.LocationCacheTTL, 24*time.Hour)
locationResolver := resolver.NewLocationResolver(env.GetRequiredString(env.IPInfoToken), providerCacheTTL)
locationResolver := resolver.NewLocationResolver(env.GetRequiredString(env.IPInfoToken), locationCacheTTL)
providerResolver, err := resolver.NewProviderResolver(
env.GetString(env.LotusAPIUrl, "https://api.node.glif.io/rpc/v0"),
env.GetString(env.LotusAPIToken, ""),
locationCacheTTL)
providerCacheTTL)
if err != nil {
panic(err)
}
Expand Down
9 changes: 5 additions & 4 deletions integration/spcoverage/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package main

import (
"os"
"time"

"github.com/data-preservation-programs/RetrievalBot/integration/filplus/util"
"github.com/data-preservation-programs/RetrievalBot/pkg/env"
"github.com/data-preservation-programs/RetrievalBot/pkg/model"
Expand All @@ -13,8 +16,6 @@ import (
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"os"
"time"
)

var logger = logging.Logger("spcoverage")
Expand Down Expand Up @@ -76,11 +77,11 @@ func run(c *cli.Context) error {

providerCacheTTL := env.GetDuration(env.ProviderCacheTTL, 24*time.Hour)
locationCacheTTL := env.GetDuration(env.LocationCacheTTL, 24*time.Hour)
locationResolver := resolver.NewLocationResolver(env.GetRequiredString(env.IPInfoToken), providerCacheTTL)
locationResolver := resolver.NewLocationResolver(env.GetRequiredString(env.IPInfoToken), locationCacheTTL)
providerResolver, err := resolver.NewProviderResolver(
env.GetString(env.LotusAPIUrl, "https://api.node.glif.io/rpc/v0"),
env.GetString(env.LotusAPIToken, ""),
locationCacheTTL)
providerCacheTTL)
if err != nil {
panic(err)
}
Expand Down

0 comments on commit f74a47a

Please sign in to comment.