gem_velocity 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -40,8 +40,8 @@ This essentially completes you being able to manipulate the boundries of the gra
40
40
 
41
41
  ## Web UI
42
42
 
43
- Do you want to just see this on web at `http://rubygems-velocity.org/gem/rails/4.0.0,3.2.14` or something similar?
44
-
45
43
  [Work](https://github.com/shaiguitar/gem_velocity_web) has been started to put it on a UI, but your feedback/contributions will be necessary for it to be useful.
46
44
 
45
+ It's available [here](http://gem-velocity.shairosenfeld.com/)
46
+
47
47
  Feel free to put your thoughts on the [issue](https://github.com/shaiguitar/gem_velocities/issues/3) and or pull requests.
@@ -11,6 +11,8 @@ class GemData
11
11
  @gem_name = gem_name
12
12
  end
13
13
 
14
+ MAX_THREADS = 20
15
+
14
16
  def parallel_fetch_for(versions)
15
17
  @mutex1 = Mutex.new
16
18
  @cached_downloads_metatada ||= {}
@@ -20,11 +22,14 @@ class GemData
20
22
  puts "fetching #{versions.size} download data requests"
21
23
  threads = []
22
24
 
23
- # TODO limit threads.
24
25
  versions.map do |v|
25
- threads << Thread.new {
26
- fetch_downloads_metadata(v,start_t,end_t,@cached_downloads_metatada)
27
- }
26
+ active_threads = threads.select{ |t| t.alive? }
27
+ if active_threads.size > MAX_THREADS
28
+ sleep 1 # busy wait thread pool
29
+ redo
30
+ else
31
+ threads << Thread.new { fetch_downloads_metadata(v,start_t,end_t,@cached_downloads_metatada) }
32
+ end
28
33
  end
29
34
  threads.map(&:join)
30
35
  end
@@ -1,3 +1,3 @@
1
1
  module GemVelocity
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
@@ -15,7 +15,7 @@ describe "a Velocitator rendering graphs" do
15
15
  # should this be the specific date range values?? aggregated since when? not aggregated?
16
16
  velocitator.graph_options[:line_datas].should == [[303, 303, 303, 304, 304]]
17
17
 
18
- velocitator.graph_options[:title].should == "haml-i18n-extractor-0.0.17\n(downloads: 386)"
18
+ velocitator.graph_options[:title].should == "haml-i18n-extractor-0.0.17\n(downloads: 410)"
19
19
  velocitator.graph_options[:labels].should == ({1=>"2013-09-13", (velocitator.line_data.size-2) =>"2013-09-17"})
20
20
  velocitator.graph_options[:max_value].should == 306 # the max in the range (time.now)
21
21
  velocitator.graph_options[:min_value].should == 0
@@ -60,7 +60,7 @@ describe SingleVelocitator do
60
60
 
61
61
  it "holds the totals of the gem" do
62
62
  velocitator = SingleVelocitator.new("haml-i18n-extractor", "0.0.17")
63
- velocitator.totals_map_by_version["0.0.17"][:version_downloads].should eq 386
63
+ velocitator.totals_map_by_version["0.0.17"][:version_downloads].should eq 410
64
64
  #binding.pry
65
65
  end
66
66
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem_velocity
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 11
10
- version: 0.0.11
9
+ - 12
10
+ version: 0.0.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Shai Rosenfeld
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-10-30 00:00:00 Z
18
+ date: 2013-11-19 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: gruff