Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe committed Apr 11, 2024
1 parent 9c64ef9 commit 255fdd7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion impl/internal/did/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io"
"net/http"
"net/url"
"time"

"github.com/TBD54566975/ssi-sdk/did"
"github.com/anacrolix/dht/v2/bep44"
Expand All @@ -25,7 +26,7 @@ func NewGatewayClient(gatewayURL string) (*GatewayClient, error) {
return nil, err
}
client := http.DefaultClient
// client.Timeout = time.Second * 10
client.Timeout = time.Second * 10
return &GatewayClient{
gatewayURL: gatewayURL,
client: client,
Expand Down
7 changes: 6 additions & 1 deletion impl/pkg/service/pkarr.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (s *PkarrService) GetPkarr(ctx context.Context, id string) (*pkarr.Response

record, err := s.db.ReadRecord(ctx, rawID)
if err != nil || record == nil {
logrus.WithContext(ctx).WithError(err).WithField("record", id).Error("failed to resolve pkarr record from storage")
logrus.WithContext(ctx).WithError(err).WithField("record", id).Error("failed to resolve pkarr record from storage; adding to badGetCache")

// add the key to the badGetCache to prevent spamming the DHT
if err = s.badGetCache.Set(id, []byte{0}); err != nil {
Expand Down Expand Up @@ -328,6 +328,11 @@ func (s *PkarrService) Close() {
logrus.WithError(err).Error("failed to close cache")
}
}
if s.badGetCache != nil {
if err := s.badGetCache.Close(); err != nil {
logrus.WithError(err).Error("failed to close badGetCache")
}
}
if err := s.db.Close(); err != nil {
logrus.WithError(err).Error("failed to close db")
}
Expand Down

0 comments on commit 255fdd7

Please sign in to comment.