1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-10 01:51:07 +09:00

GO-2290 Faster retries and update any-sync

This commit is contained in:
mcrakhman 2023-10-28 12:16:04 +02:00
parent b4ea453b6d
commit b817530ee5
No known key found for this signature in database
GPG key ID: DED12CFEF5B8396B
3 changed files with 9 additions and 7 deletions

2
go.mod
View file

@ -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.3.6-0.20231027195759-71df6b060220
github.com/anyproto/any-sync v0.3.6
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.10

6
go.sum
View file

@ -82,10 +82,8 @@ github.com/andybalholm/cascadia v1.2.0/go.mod h1:YCyR8vOZT9aZ1CHEd8ap0gMVm2aFgxB
github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA=
github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss=
github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU=
github.com/anyproto/any-sync v0.3.4 h1:WbhYJ8adThXWOPFAfoCdvsj1kbsQKtMman0tmSYVMGk=
github.com/anyproto/any-sync v0.3.4/go.mod h1:b5VBU4kw1df4ezTYZd9iPEVzPZcDfTGfjis6gUortQc=
github.com/anyproto/any-sync v0.3.6-0.20231027195759-71df6b060220 h1:UBAt2ltvw/fE/mKKpn6wWVq2f/ObHzefFbiUBdbGVa8=
github.com/anyproto/any-sync v0.3.6-0.20231027195759-71df6b060220/go.mod h1:b5VBU4kw1df4ezTYZd9iPEVzPZcDfTGfjis6gUortQc=
github.com/anyproto/any-sync v0.3.6 h1:a8M9JMi9TEwskZI3ePYNrgmE/4se/ymrs+Q0SomXA7Q=
github.com/anyproto/any-sync v0.3.6/go.mod h1:b5VBU4kw1df4ezTYZd9iPEVzPZcDfTGfjis6gUortQc=
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-gelf v0.0.0-20210418191311-774bd5b016e7 h1:SyEu5uxZ5nKHEJ6TPKQqjM+T00SYi0MW1VaLzqZtZ9E=

View file

@ -52,17 +52,21 @@ func (ls *loadingSpace) loadRetry(ctx context.Context) {
if ls.load(ctx) {
return
}
ticker := time.NewTicker(ls.retryTimeout)
timeout := 1 * time.Second
for {
select {
case <-ctx.Done():
ls.loadErr = ctx.Err()
return
case <-ticker.C:
case <-time.After(timeout):
if ls.load(ctx) {
return
}
}
timeout *= 2
if timeout > ls.retryTimeout {
timeout = ls.retryTimeout
}
}
}