Priority queue use the priority to decide which one pop first, and small priority one would be pop 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