Priority queue use the priority to decide which one pop first, and small priority first. And the more active repo should be pop first, so priority of repo would minus its new ref times to make its priority small. But some times, the result can be negative, this make the repo delayed a lot.
Signed-off-by: Li Yuanchao lyc163mail@163.com --- lib/git_mirror.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/git_mirror.rb b/lib/git_mirror.rb index 940d5e2..39b1619 100644 --- a/lib/git_mirror.rb +++ b/lib/git_mirror.rb @@ -203,7 +203,8 @@ class MirrorMain
fork_key = @priority_queue.delete_min_return_key do_push(fork_key) - @priority_queue.push fork_key, (@priority - @fork_stat[fork_key][:priority]) + priority_set = @priority > @fork_stat[fork_key][:priority] ? (@priority - @fork_stat[fork_key][:priority]) : 1 + @priority_queue.push fork_key, priority_set @priority += 1 end
On Wed, Feb 10, 2021 at 04:16:42PM +0800, Li Yuanchao wrote:
Priority queue use the priority to decide which one pop first, and small priority first. And the more active repo should be pop first, so priority of repo would minus its new ref times to make its priority small. But some times, the result can be negative, this make the repo delayed a lot.
Would you like to use paragraph in your change log?
Thanks, Xueliang
Signed-off-by: Li Yuanchao lyc163mail@163.com
lib/git_mirror.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/git_mirror.rb b/lib/git_mirror.rb index 940d5e2..39b1619 100644 --- a/lib/git_mirror.rb +++ b/lib/git_mirror.rb @@ -203,7 +203,8 @@ class MirrorMain
fork_key = @priority_queue.delete_min_return_key do_push(fork_key)
- @priority_queue.push fork_key, (@priority - @fork_stat[fork_key][:priority])
- priority_set = @priority > @fork_stat[fork_key][:priority] ? (@priority - @fork_stat[fork_key][:priority]) : 1
- @priority_queue.push fork_key, priority_set @priority += 1 end
-- 2.23.0
On Thu, Feb 18, 2021 at 11:45:04AM +0800, Cao Xueliang wrote:
On Wed, Feb 10, 2021 at 04:16:42PM +0800, Li Yuanchao wrote:
Priority queue use the priority to decide which one pop first, and small priority first. And the more active repo should be pop first, so priority of repo would minus its new ref times to make its priority small. But some times, the result can be negative, this make the repo delayed a lot.
Would you like to use paragraph in your change log?
ok