Skip to content

Commit 235b7ea

Browse files
committed
fix(p2p): temporary workaround to reduce pressure on task heap (this sucks)
1 parent 2684c31 commit 235b7ea

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

faws/repo/p2p/pull_job.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func (pull_job *pull_job) worker() (err error) {
6060
return
6161
}
6262

63-
load_scale := float64(1) / float64(subscription.object_wishlist.Len())
63+
load_scale := float64(1) / float64(subscription.object_wishlist.AvailableLen())
6464
duration := time.Duration(float64(1500)*load_scale) * time.Millisecond
6565
time.Sleep(duration)
6666

faws/repo/p2p/tracker/manifest.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ func DecodeManifestInfo(b []byte, topic Topic, out *ManifestInfo) (err error) {
173173
return
174174
}
175175
tag_names[i] = tag_name
176+
cleartext = cleartext[tag_name_lengths[i]:]
176177
}
177178
// tie hashes and tags together
178179
out.Tags = make([]revision.Tag, num_tags)

faws/repo/queue/task_heap.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,10 @@ func (task_heap *TaskHeap[T]) Len() (n int) {
8484
task_heap.guard_items.Unlock()
8585
return
8686
}
87+
88+
func (task_heap *TaskHeap[T]) AvailableLen() (n int) {
89+
task_heap.guard_items.Lock()
90+
n = task_heap.available_items.Len()
91+
task_heap.guard_items.Unlock()
92+
return
93+
}

0 commit comments

Comments
 (0)