perfectqueue 0.8.8 → 0.8.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +6 -0
- data/lib/perfectqueue/backend/rdb_compat.rb +4 -3
- data/lib/perfectqueue/version.rb +1 -1
- data/lib/perfectqueue/worker.rb +12 -4
- metadata +2 -2
data/ChangeLog
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
|
2
|
+
== 2012-08-03 version 0.8.9
|
3
|
+
|
4
|
+
* Use free slot ratio instead of free slot amount to decide task priorities
|
5
|
+
* Disable immediate binary replace on platforms which doesn't support SIGPWR
|
6
|
+
|
7
|
+
|
2
8
|
== 2012-07-26 version 0.8.8
|
3
9
|
|
4
10
|
* Use PWR instead of EMT signal which is not supported by ruby
|
@@ -44,7 +44,7 @@ module PerfectQueue
|
|
44
44
|
}
|
45
45
|
|
46
46
|
@sql = <<SQL
|
47
|
-
SELECT id, timeout, data, created_at, resource, max_running
|
47
|
+
SELECT id, timeout, data, created_at, resource, max_running/running AS weight
|
48
48
|
FROM `#{@table}`
|
49
49
|
LEFT JOIN (
|
50
50
|
SELECT resource AS res, COUNT(1) AS running
|
@@ -53,7 +53,7 @@ LEFT JOIN (
|
|
53
53
|
GROUP BY resource
|
54
54
|
) AS R ON resource = res
|
55
55
|
WHERE timeout <= ? AND (max_running-running IS NULL OR max_running-running > 0)
|
56
|
-
ORDER BY
|
56
|
+
ORDER BY weight IS NOT NULL, weight DESC, timeout ASC
|
57
57
|
LIMIT #{MAX_SELECT_ROW}
|
58
58
|
SQL
|
59
59
|
|
@@ -124,7 +124,8 @@ SQL
|
|
124
124
|
def submit(key, type, data, options)
|
125
125
|
now = (options[:now] || Time.now).to_i
|
126
126
|
run_at = (options[:run_at] || now).to_i
|
127
|
-
user = options[:user]
|
127
|
+
user = options[:user]
|
128
|
+
user = user.to_s if user
|
128
129
|
max_running = options[:max_running]
|
129
130
|
data = data ? data.dup : {}
|
130
131
|
data['type'] = type
|
data/lib/perfectqueue/version.rb
CHANGED
data/lib/perfectqueue/worker.rb
CHANGED
@@ -132,12 +132,20 @@ module PerfectQueue
|
|
132
132
|
restart(true)
|
133
133
|
end
|
134
134
|
|
135
|
-
|
136
|
-
|
135
|
+
begin
|
136
|
+
sig.trap :WINCH do
|
137
|
+
replace(false)
|
138
|
+
end
|
139
|
+
rescue
|
140
|
+
# FIXME some platforms might not support SIGWINCH
|
137
141
|
end
|
138
142
|
|
139
|
-
|
140
|
-
|
143
|
+
begin
|
144
|
+
sig.trap :PWR do
|
145
|
+
replace(true)
|
146
|
+
end
|
147
|
+
rescue
|
148
|
+
# FIXME some platforms might not support SIGPWR (such as Darwin)
|
141
149
|
end
|
142
150
|
|
143
151
|
sig.trap :USR2 do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: perfectqueue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sequel
|