Skip to content

Commit

Permalink
Simplify remote load (remove retries)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcrakhman committed Jun 13, 2023
1 parent a21a202 commit d2c4e77
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion core/block/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ func (s *Service) getDerivedObject(
optsKey,
cacheOpts{
buildOption: source.BuildOptions{
RetryRemoteLoad: true,
// TODO: revive p2p (right now we are not ready to load from local clients due to the fact that we need to know when local peers connect)
},
},
)
Expand Down
10 changes: 1 addition & 9 deletions core/block/source/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"strings"
"sync"
"time"

"github.com/anyproto/any-sync/accountservice"
"github.com/anyproto/any-sync/app"
Expand Down Expand Up @@ -71,19 +70,12 @@ func (s *service) Name() (name string) {

type BuildOptions struct {
DisableRemoteLoad bool
RetryRemoteLoad bool // anysync only; useful for account cold load from p2p nodes
Listener updatelistener.UpdateListener
}

func (b *BuildOptions) BuildTreeOpts() objecttreebuilder.BuildTreeOpts {
var retryTimeout time.Duration
// we will try to reconnect during the ctx timeout if RetryRemoteLoad is set
if b.RetryRemoteLoad {
retryTimeout = time.Minute
}
return objecttreebuilder.BuildTreeOpts{
Listener: b.Listener,
RetryTimeout: retryTimeout,
Listener: b.Listener,
}
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/PuerkitoBio/goquery v1.8.1
github.com/VividCortex/ewma v1.2.0
github.com/adrium/goheif v0.0.0-20230113233934-ca402e77a786
github.com/anyproto/any-sync v0.2.2
github.com/anyproto/any-sync v0.2.3
github.com/anyproto/go-naturaldate/v2 v2.0.2-0.20230524105841-9829cfd13438
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de
github.com/blevesearch/bleve/v2 v2.3.8
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ github.com/andybalholm/cascadia v1.2.0/go.mod h1:YCyR8vOZT9aZ1CHEd8ap0gMVm2aFgxB
github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c=
github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/anyproto/any-sync v0.2.2 h1:pefWmg+/rK3DvFPhT7MDc8YNi9Yl0HNhVXNvwOJQP0g=
github.com/anyproto/any-sync v0.2.2/go.mod h1:U8NhzTbGCSE9Yf2CfvBTGtNPAYl6zrZT2vZypab2mck=
github.com/anyproto/any-sync v0.2.3 h1:e4I1cnzBWDdqaRnkX2341yExPNih/sdvnpCXz70bw5M=
github.com/anyproto/any-sync v0.2.3/go.mod h1:U8NhzTbGCSE9Yf2CfvBTGtNPAYl6zrZT2vZypab2mck=
github.com/anyproto/go-chash v0.1.0 h1:I9meTPjXFRfXZHRJzjOHC/XF7Q5vzysKkiT/grsogXY=
github.com/anyproto/go-chash v0.1.0/go.mod h1:0UjNQi3PDazP0fINpFYu6VKhuna+W/V+1vpXHAfNgLY=
github.com/anyproto/go-ds-badger3 v0.3.1-0.20230524095230-434cf6346d9b h1:SMizb43hfILk2bpMgpTd30n6yQQdxW0ZbDti0wqfsBw=
Expand Down

0 comments on commit d2c4e77

Please sign in to comment.