qmore 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 81dfd049f15b6991030f758016c3b47f4590a591
4
- data.tar.gz: e940b3230a609ae3d40c732d91ca017ca23d7dac
3
+ metadata.gz: 6f079f1d98ba4c005750de9469e2606766e18ea3
4
+ data.tar.gz: c736db45bb274e617bca058222298eea4fa55b8e
5
5
  SHA512:
6
- metadata.gz: 4a34b907609e0c0aad6502255b847cadd2e1ac1576a77db9bb8dee1c2fc2a04015c9b0d9fee7a887b12274aa258fe396b6d9109799f0439b1603507b08dcf4ca
7
- data.tar.gz: e897e91ffa701441f469f509a67006506cb968e3728d18974c89397e46a7987fe0aa9a0c08bc672e88e1514706e75103e2d7fa260a69f087ec4752b545d0ba55
6
+ metadata.gz: f847b813fd9f3d01073060a3efad7373e7e50cd8c37def71be557f05b0e2ef9e078fb54dc3239cac8d68831991ef5c58ac5d377ed1044b41ece77490aa0bfa74
7
+ data.tar.gz: 8e7f39e5973a0dddb8d8e4cac20ffe4e1e1862b075b2962f2121f90332b4dcfb6fae180317411374715a0a61330d3a6bee4392eb9b6b78846479001b97248b1a
@@ -2,7 +2,5 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
- - 2.1.0
6
- services:
7
- - redis-server
5
+ - 2.1.1
8
6
  script: bundle exec rspec spec
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ 0.6.1 (03/05/2014)
2
+ ------------------
3
+
4
+ shuffle clients so we do not select from the same order of clients every time <58edfde> [james-lawrence]
5
+
1
6
  0.6.0 (02/25/2014)
2
7
  ------------------
3
8
 
@@ -39,7 +39,8 @@ module Qmore
39
39
  def realize_queues
40
40
  realized_queues = []
41
41
 
42
- self.clients.each do |client, regexes|
42
+ self.clients.keys.shuffle.each do |client|
43
+ regexes = self.clients[client]
43
44
  # Cache the queues so we don't make multiple calls.
44
45
  actual_queues = client.queues
45
46
 
@@ -1,3 +1,3 @@
1
1
  module Qmore
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
@@ -26,10 +26,19 @@ describe "JobReserver" do
26
26
  queue_a.length.should == 0
27
27
  queue_b.length.should == 0
28
28
  end
29
+
30
+ it "shuffles the order of the clients" do
31
+ queue = Qmore.client.queues['queue']
32
+
33
+ reserver = Qmore::JobReserver.new([queue])
34
+ k = reserver.clients.keys
35
+ k.should_receive(:shuffle).once.and_return(reserver.clients.keys)
36
+ reserver.clients.should_receive(:keys).and_return(k)
37
+ reserver.reserve
38
+ end
29
39
  end
30
40
 
31
41
  context "basic qless behavior still works" do
32
-
33
42
  it "can reserve from multiple queues" do
34
43
  high_queue = Qmore.client.queues['high']
35
44
  critical_queue = Qmore.client.queues['critical']
@@ -38,6 +47,7 @@ describe "JobReserver" do
38
47
  critical_queue.put(SomeJob, [])
39
48
 
40
49
  reserver = Qmore::JobReserver.new([critical_queue, high_queue])
50
+
41
51
  reserver.reserve.queue.name.should == 'critical'
42
52
  reserver.reserve.queue.name.should == 'high'
43
53
  end
@@ -76,7 +76,7 @@ save 60 10000
76
76
  rdbcompression yes
77
77
 
78
78
  # The filename where to dump the DB
79
- dbfilename ./qless01-test-dump.rdb
79
+ dbfilename qless01-test-dump.rdb
80
80
 
81
81
  # The working directory.
82
82
  #
@@ -76,7 +76,7 @@ save 60 10000
76
76
  rdbcompression yes
77
77
 
78
78
  # The filename where to dump the DB
79
- dbfilename ./qless02-test-dump.rdb
79
+ dbfilename qless02-test-dump.rdb
80
80
 
81
81
  # The working directory.
82
82
  #
@@ -5,26 +5,23 @@ Coveralls.wear!
5
5
 
6
6
  require 'qmore'
7
7
 
8
- # No need to start redis when running in Travis
9
- unless ENV['CI']
10
- redis_configs_directory = File.join(File.dirname(File.expand_path(__FILE__)), "redis")
11
- redis_configs = Dir.entries(redis_configs_directory).select{|f| !File.directory? f}
8
+ redis_configs_directory = File.join(File.dirname(File.expand_path(__FILE__)), "redis")
9
+ redis_configs = Dir.entries(redis_configs_directory).select{|f| !File.directory? f}
12
10
 
13
- redis_configs.each do |config|
14
- redis_cmd = "redis-server #{redis_configs_directory}/#{config}"
15
- puts "Starting redis for testing at localhost..."
16
- puts `cd #{redis_configs_directory}; #{redis_cmd}`
11
+ redis_configs.each do |config|
12
+ redis_cmd = "redis-server #{redis_configs_directory}/#{config}"
13
+ puts "Starting redis for testing at localhost..."
14
+ puts `cd #{redis_configs_directory}; #{redis_cmd}`
17
15
 
18
- # Schedule the redis server for shutdown when tests are all finished.
19
- at_exit do
20
- redis_instance_name = config.chomp(".conf")
21
- puts 'Stopping redis'
22
- pid = File.read("#{redis_configs_directory}/#{redis_instance_name}.pid").to_i rescue nil
23
- system ("kill -9 #{pid}") if pid.to_i != 0
24
- File.delete("#{redis_configs_directory}/#{redis_instance_name}.pid") rescue nil
25
- File.delete("#{redis_configs_directory}/#{redis_instance_name}-server.log") rescue nil
26
- File.delete("#{redis_configs_directory}/#{redis_instance_name}-dump.rdb") rescue nil
27
- end
16
+ # Schedule the redis server for shutdown when tests are all finished.
17
+ at_exit do
18
+ redis_instance_name = config.chomp(".conf")
19
+ puts 'Stopping redis'
20
+ pid = File.read("#{redis_configs_directory}/#{redis_instance_name}.pid").to_i rescue nil
21
+ system ("kill -9 #{pid}") if pid.to_i != 0
22
+ File.delete("#{redis_configs_directory}/#{redis_instance_name}.pid") rescue nil
23
+ File.delete("#{redis_configs_directory}/#{redis_instance_name}-server.log") rescue nil
24
+ File.delete("#{redis_configs_directory}/#{redis_instance_name}-dump.rdb") rescue nil
28
25
  end
29
26
  end
30
27
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qmore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Conway
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-25 00:00:00.000000000 Z
11
+ date: 2014-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: qless