Skip to content

Instantly share code, notes, and snippets.

@bleonard
Created January 14, 2013 04:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bleonard/4527766 to your computer and use it in GitHub Desktop.
Save bleonard/4527766 to your computer and use it in GitHub Desktop.
def commits(&block)
mutex = Mutex.new
queue = self.repositories(username)
self.thread_count.times.map {
Thread.new do
while repo_name = mutex.synchronize { queue.pop }
# get windows and then each sha
repo_commits(repo_name, username, start_time, end_time) do |commit|
mutex.synchronize { block.call commit }
end
end
end
}.each(&:join)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment