Better track related incoming sync targets
This commit is contained in:
parent
bbc61a8f86
commit
7a308b60a6
@ -108,6 +108,15 @@ func newSyncTargetBucket(tipsets ...*types.TipSet) *syncTargetBucket {
|
|||||||
return &stb
|
return &stb
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (sbs *syncBucketSet) RelatedToAny(ts *types.TipSet) bool {
|
||||||
|
for _, b := range sbs.buckets {
|
||||||
|
if b.sameChainAs(ts) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (sbs *syncBucketSet) Insert(ts *types.TipSet) {
|
func (sbs *syncBucketSet) Insert(ts *types.TipSet) {
|
||||||
for _, b := range sbs.buckets {
|
for _, b := range sbs.buckets {
|
||||||
if b.sameChainAs(ts) {
|
if b.sameChainAs(ts) {
|
||||||
@ -265,12 +274,16 @@ func (sm *SyncManager) scheduleIncoming(ts *types.TipSet) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
if types.CidArrsEqual(ts.Parents(), acts.Cids()) {
|
if types.CidArrsEqual(ts.Parents(), acts.Cids()) || types.CidArrsEqual(ts.Parents(), acts.Parents()) {
|
||||||
// sync this next, after that sync process finishes
|
// sync this next, after that sync process finishes
|
||||||
relatedToActiveSync = true
|
relatedToActiveSync = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !relatedToActiveSync && sm.activeSyncTips.RelatedToAny(ts) {
|
||||||
|
relatedToActiveSync = true
|
||||||
|
}
|
||||||
|
|
||||||
// if this is related to an active sync process, immediately bucket it
|
// if this is related to an active sync process, immediately bucket it
|
||||||
// we don't want to start a parallel sync process that duplicates work
|
// we don't want to start a parallel sync process that duplicates work
|
||||||
if relatedToActiveSync {
|
if relatedToActiveSync {
|
||||||
|
Loading…
Reference in New Issue
Block a user