resque-dynamic-queues 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
@@ -41,7 +41,7 @@ task :changelog do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
# Generate changelog from repo
|
44
|
-
log=`git log --pretty='format:%s <%h> [%cn]' #{newest_tag}
|
44
|
+
log=`git log --pretty='format:%s <%h> [%cn]' #{newest_tag}..HEAD`
|
45
45
|
|
46
46
|
# Strip out maintenance entries
|
47
47
|
log = log.lines.to_a.delete_if do |l|
|
@@ -1,13 +1,17 @@
|
|
1
1
|
module Resque
|
2
2
|
module Plugins
|
3
3
|
module DynamicQueues
|
4
|
+
|
5
|
+
KEY_PREFIX = "dynamic_queue"
|
6
|
+
FALLBACK_KEY = "default"
|
7
|
+
|
4
8
|
module Attributes
|
5
9
|
|
6
10
|
def get_dynamic_queue(key)
|
7
|
-
queue_names = redis.lrange("
|
11
|
+
queue_names = redis.lrange("#{KEY_PREFIX}:#{key}", 0, -1)
|
8
12
|
|
9
13
|
if queue_names.nil? || queue_names.size == 0
|
10
|
-
queue_names = redis.lrange("
|
14
|
+
queue_names = redis.lrange("#{KEY_PREFIX}:#{FALLBACK_KEY}", 0, -1)
|
11
15
|
end
|
12
16
|
|
13
17
|
if queue_names.nil? || queue_names.size == 0
|
@@ -18,15 +22,20 @@ module Resque
|
|
18
22
|
end
|
19
23
|
|
20
24
|
def set_dynamic_queue(key, values)
|
21
|
-
k = "
|
22
|
-
redis.
|
23
|
-
|
24
|
-
|
25
|
+
k = "#{KEY_PREFIX}:#{key}"
|
26
|
+
redis.multi do
|
27
|
+
redis.del(k)
|
28
|
+
Array(values).each do |v|
|
29
|
+
redis.rpush(k, v)
|
30
|
+
end
|
25
31
|
end
|
26
32
|
end
|
27
33
|
|
28
34
|
def get_dynamic_queues
|
29
|
-
|
35
|
+
dqueues = redis.keys("#{KEY_PREFIX}:*") || []
|
36
|
+
dqueues = dqueues.collect{|q| q.gsub('dynamic_queue:', '')}
|
37
|
+
dqueues << FALLBACK_KEY unless dqueues.include?(FALLBACK_KEY)
|
38
|
+
return dqueues
|
30
39
|
end
|
31
40
|
|
32
41
|
end
|
@@ -18,14 +18,6 @@
|
|
18
18
|
</td>
|
19
19
|
</tr>
|
20
20
|
<% end %>
|
21
|
-
<tr>
|
22
|
-
<td>Fallback</td>
|
23
|
-
<td>-</td>
|
24
|
-
<td><%= Resque::Worker.new("@---").queues.join(', ') %></td>
|
25
|
-
<td></td>
|
26
|
-
<td>
|
27
|
-
</td>
|
28
|
-
</tr>
|
29
21
|
</table>
|
30
22
|
|
31
23
|
|
@@ -47,7 +39,7 @@
|
|
47
39
|
e.preventDefault();
|
48
40
|
var $link = $(this),
|
49
41
|
url = $link.attr('href'),
|
50
|
-
confirmed = confirm("Are you sure you want to
|
42
|
+
confirmed = confirm("Are you sure you want to remove this dynamic queue? There is no undo.");
|
51
43
|
if (confirmed) {
|
52
44
|
$link.animate({opacity: 0.5});
|
53
45
|
$.ajax({
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque-dynamic-queues
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
13
|
-
default_executable:
|
12
|
+
date: 2011-12-07 00:00:00.000000000Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: resque
|
17
|
-
requirement: &
|
16
|
+
requirement: &2176833480 !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
18
|
requirements:
|
20
19
|
- - ~>
|
@@ -22,10 +21,10 @@ dependencies:
|
|
22
21
|
version: '1.10'
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
|
-
version_requirements: *
|
24
|
+
version_requirements: *2176833480
|
26
25
|
- !ruby/object:Gem::Dependency
|
27
26
|
name: rspec
|
28
|
-
requirement: &
|
27
|
+
requirement: &2176808620 !ruby/object:Gem::Requirement
|
29
28
|
none: false
|
30
29
|
requirements:
|
31
30
|
- - ~>
|
@@ -33,10 +32,10 @@ dependencies:
|
|
33
32
|
version: '2.5'
|
34
33
|
type: :development
|
35
34
|
prerelease: false
|
36
|
-
version_requirements: *
|
35
|
+
version_requirements: *2176808620
|
37
36
|
- !ruby/object:Gem::Dependency
|
38
37
|
name: rack-test
|
39
|
-
requirement: &
|
38
|
+
requirement: &2176798820 !ruby/object:Gem::Requirement
|
40
39
|
none: false
|
41
40
|
requirements:
|
42
41
|
- - ~>
|
@@ -44,7 +43,7 @@ dependencies:
|
|
44
43
|
version: 0.5.4
|
45
44
|
type: :development
|
46
45
|
prerelease: false
|
47
|
-
version_requirements: *
|
46
|
+
version_requirements: *2176798820
|
48
47
|
description: A resque plugin for specifying the queues a worker pulls from with wildcards,
|
49
48
|
negations, or dynamic look up from redis
|
50
49
|
email:
|
@@ -71,7 +70,6 @@ files:
|
|
71
70
|
- spec/redis-test.conf
|
72
71
|
- spec/server_spec.rb
|
73
72
|
- spec/spec_helper.rb
|
74
|
-
has_rdoc: true
|
75
73
|
homepage: ''
|
76
74
|
licenses: []
|
77
75
|
post_install_message:
|
@@ -92,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
90
|
version: '0'
|
93
91
|
requirements: []
|
94
92
|
rubyforge_project: resque-dynamic-queues
|
95
|
-
rubygems_version: 1.
|
93
|
+
rubygems_version: 1.8.10
|
96
94
|
signing_key:
|
97
95
|
specification_version: 3
|
98
96
|
summary: A resque plugin for specifying the queues a worker pulls from with wildcards,
|
@@ -102,3 +100,4 @@ test_files:
|
|
102
100
|
- spec/redis-test.conf
|
103
101
|
- spec/server_spec.rb
|
104
102
|
- spec/spec_helper.rb
|
103
|
+
has_rdoc:
|