resque-cleaner 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,8 @@
1
+ ## 0.2.1 (2011-04-06)
2
+
3
+ * BUGFIX: Bulk action didn't work properly when you select all jobs.
4
+ * Removed absolute paths from html.
5
+
1
6
  ## 0.2.0 (2011-04-06)
2
7
 
3
8
  * Extended with resque-web
@@ -121,11 +121,7 @@ module ResqueCleaner
121
121
  get "/cleaner_list" do
122
122
  load_cleaner_filter
123
123
 
124
- block = lambda{|j|
125
- (!@from || j.after?(hours_ago(@from))) &&
126
- (!@to || j.before?(hours_ago(@to))) &&
127
- (!@klass || j.klass?(@klass))
128
- }
124
+ block = filter_block
129
125
 
130
126
  @failed = cleaner.select(&block).reverse
131
127
 
@@ -141,29 +137,20 @@ module ResqueCleaner
141
137
  post "/cleaner_exec" do
142
138
  load_cleaner_filter
143
139
 
144
- @sha1 = nil
145
140
  if params[:select_all_pages]!="1"
146
141
  @sha1 = {}
147
- params[:sha1].split(",").each do |s|
148
- @sha1[s] = true
149
- end
142
+ params[:sha1].split(",").each {|s| @sha1[s] = true }
150
143
  end
151
144
 
152
- block = lambda{|j|
153
- (!@from || j.after?(hours_ago(@from))) &&
154
- (!@to || j.before?(hours_ago(@to))) &&
155
- (!@klass || j.klass?(@klass))
156
- (!@sha1 || @sha1[Digest::SHA1.hexdigest(j.to_json)])
157
- }
145
+ block = filter_block
158
146
 
159
- count =
147
+ @count =
160
148
  case params[:action]
161
149
  when "clear" then cleaner.clear(&block)
162
150
  when "retry_and_clear" then cleaner.requeue(true,&block)
163
151
  when "retry" then cleaner.requeue(false,{},&block)
164
152
  end
165
153
 
166
- @msg = "processed #{count} jobs."
167
154
  @url = "cleaner_list?c=#{@klass}&f=#{@from}&t=#{@to}"
168
155
  erb File.read(ResqueCleaner::Server.erb_path('cleaner_exec.erb'))
169
156
  end
@@ -192,6 +179,15 @@ module ResqueCleaner
192
179
  @klass = params[:c]=="" ? nil : params[:c]
193
180
  end
194
181
 
182
+ def filter_block
183
+ block = lambda{|j|
184
+ (!@from || j.after?(hours_ago(@from))) &&
185
+ (!@to || j.before?(hours_ago(@to))) &&
186
+ (!@klass || j.klass?(@klass)) &&
187
+ (!@sha1 || @sha1[Digest::SHA1.hexdigest(j.to_json)])
188
+ }
189
+ end
190
+
195
191
  def hours_ago(h)
196
192
  Time.now - h.to_i*60*60
197
193
  end
@@ -1,4 +1,4 @@
1
- <link href="/cleaner/public/cleaner.css" media="screen" rel="stylesheet" type="text/css">
1
+ <link href="cleaner/public/cleaner.css" media="screen" rel="stylesheet" type="text/css">
2
2
 
3
3
  <div class="cleaner">
4
4
  <div class="title clearfix">
@@ -18,22 +18,22 @@
18
18
  <% @stats.each do |klass,count| %>
19
19
  <tr>
20
20
  <td><%= klass %></td>
21
- <td class="number"><a href="/cleaner_list?c=<%=klass%>"><%= count["total"] %></a></td>
22
- <td class="number"><a href="/cleaner_list?c=<%=klass%>&f=1"><%= count["1h"] %></a></td>
23
- <td class="number"><a href="/cleaner_list?c=<%=klass%>&f=3"><%= count["3h"] %></a></td>
24
- <td class="number"><a href="/cleaner_list?c=<%=klass%>&f=24"><%= count["1d"] %></a></td>
25
- <td class="number"><a href="/cleaner_list?c=<%=klass%>&f=72"><%= count["3d"] %></a></td>
26
- <td class="number"><a href="/cleaner_list?c=<%=klass%>&f=168"><%= count["7d"] %></a></td>
21
+ <td class="number"><a href="cleaner_list?c=<%=klass%>"><%= count["total"] %></a></td>
22
+ <td class="number"><a href="cleaner_list?c=<%=klass%>&f=1"><%= count["1h"] %></a></td>
23
+ <td class="number"><a href="cleaner_list?c=<%=klass%>&f=3"><%= count["3h"] %></a></td>
24
+ <td class="number"><a href="cleaner_list?c=<%=klass%>&f=24"><%= count["1d"] %></a></td>
25
+ <td class="number"><a href="cleaner_list?c=<%=klass%>&f=72"><%= count["3d"] %></a></td>
26
+ <td class="number"><a href="cleaner_list?c=<%=klass%>&f=168"><%= count["7d"] %></a></td>
27
27
  </tr>
28
28
  <% end %>
29
29
  <tr class="total">
30
30
  <td>Total</td>
31
- <td class="number"><a href="/cleaner_list"><%= @total["total"] %></a></td>
32
- <td class="number"><a href="/cleaner_list?f=1"><%= @total["1h"] %></a></td>
33
- <td class="number"><a href="/cleaner_list?f=3"><%= @total["3h"] %></a></td>
34
- <td class="number"><a href="/cleaner_list?f=24"><%= @total["1d"] %></a></td>
35
- <td class="number"><a href="/cleaner_list?f=72"><%= @total["3d"] %></a></td>
36
- <td class="number"><a href="/cleaner_list?f=168"><%= @total["7d"] %></a></td>
31
+ <td class="number"><a href="cleaner_list"><%= @total["total"] %></a></td>
32
+ <td class="number"><a href="cleaner_list?f=1"><%= @total["1h"] %></a></td>
33
+ <td class="number"><a href="cleaner_list?f=3"><%= @total["3h"] %></a></td>
34
+ <td class="number"><a href="cleaner_list?f=24"><%= @total["1d"] %></a></td>
35
+ <td class="number"><a href="cleaner_list?f=72"><%= @total["3d"] %></a></td>
36
+ <td class="number"><a href="cleaner_list?f=168"><%= @total["7d"] %></a></td>
37
37
  </tr>
38
38
  </table>
39
39
 
@@ -1,7 +1,7 @@
1
- <link href="/cleaner/public/cleaner.css" media="screen" rel="stylesheet" type="text/css">
1
+ <link href="cleaner/public/cleaner.css" media="screen" rel="stylesheet" type="text/css">
2
2
 
3
3
  <div class="cleaner">
4
- <p class="message"><%= @msg %></p>
4
+ <p class="message">Processed <%= @count %> jobs.</p>
5
5
  <p class="back_to_list">
6
6
  <a href="<%=@url%>">Back to List</a>
7
7
  </p>
@@ -1,4 +1,4 @@
1
- <link href="/cleaner/public/cleaner.css" media="screen" rel="stylesheet" type="text/css">
1
+ <link href="cleaner/public/cleaner.css" media="screen" rel="stylesheet" type="text/css">
2
2
 
3
3
  <!-- Many code was copied from failed.erb of the original resque -->
4
4
  <div class="cleaner">
@@ -26,7 +26,7 @@
26
26
  <% if @count > 0 %>
27
27
  <div class="clearfix">
28
28
  <div class="control_panel sub_header">
29
- <form method="post" id="exec" action="/cleaner_exec">
29
+ <form method="post" id="exec" action="cleaner_exec">
30
30
  <input type="hidden" name="c" value="<%=@klass%>" />
31
31
  <input type="hidden" name="f" value="<%=@from%>" />
32
32
  <input type="hidden" name="t" value="<%=@to%>" />
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-cleaner
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 21
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 2
8
- - 0
9
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Tatsuya Ono
@@ -25,6 +26,7 @@ dependencies:
25
26
  requirements:
26
27
  - - ~>
27
28
  - !ruby/object:Gem::Version
29
+ hash: 15
28
30
  segments:
29
31
  - 1
30
32
  - 0
@@ -73,6 +75,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
73
75
  requirements:
74
76
  - - ">="
75
77
  - !ruby/object:Gem::Version
78
+ hash: 3
76
79
  segments:
77
80
  - 0
78
81
  version: "0"
@@ -81,6 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
84
  requirements:
82
85
  - - ">="
83
86
  - !ruby/object:Gem::Version
87
+ hash: 3
84
88
  segments:
85
89
  - 0
86
90
  version: "0"