sidekiq-history 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sidekiq/history.rb +9 -1
- data/lib/sidekiq/history/middleware.rb +14 -2
- data/lib/sidekiq/history/version.rb +1 -1
- data/lib/sidekiq/history/web_extension.rb +15 -1
- data/web/views/history.erb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6706f6114baf8bd2857f5a026db7c2a10a1e8b28
|
4
|
+
data.tar.gz: 551c77a01e74c87c36d954c6935fa157a1030146
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ca66b193bd21ac805c9eccbb12094d7558e0858bd064fa7fda76d2171fc58e32e0741351665ab60fb32b7424c9ccabbaf43d62b7f55c1085dc90e3973d50a01
|
7
|
+
data.tar.gz: 02fef2c9d2aa38a22e497d0a94eb6d536ae30df0281c68574dade96773093276975bdb4a1f4cf233291e380ff4ec549f88a924b19ced1a04e3bd8cba5663aad1
|
data/lib/sidekiq/history.rb
CHANGED
@@ -26,9 +26,17 @@ module Sidekiq
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def self.count
|
29
|
-
Sidekiq.redis { |r| r.
|
29
|
+
Sidekiq.redis { |r| r.zcard(LIST_KEY) }
|
30
30
|
end
|
31
|
+
|
32
|
+
class HistorySet < Sidekiq::JobSet
|
33
|
+
def initialize
|
34
|
+
super LIST_KEY
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
31
38
|
end
|
39
|
+
|
32
40
|
end
|
33
41
|
|
34
42
|
Sidekiq.configure_server do |config|
|
@@ -19,9 +19,21 @@ module Sidekiq
|
|
19
19
|
}
|
20
20
|
|
21
21
|
Sidekiq.redis do |conn|
|
22
|
-
|
22
|
+
# migration of list to set for backwards compatibility after v0.0.4
|
23
|
+
if conn.type(LIST_KEY) == 'list'
|
24
|
+
length = conn.llen(LIST_KEY)
|
25
|
+
list = conn.lrange(LIST_KEY, 0, length)
|
26
|
+
conn.del(LIST_KEY)
|
27
|
+
list.each do |entry|
|
28
|
+
migrated_data = JSON.parse(entry)
|
29
|
+
conn.zadd(LIST_KEY, data[:started_at].to_f, Sidekiq.dump_json(migrated_data))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# regular storage of history
|
34
|
+
conn.zadd(LIST_KEY, data[:started_at].to_f, Sidekiq.dump_json(data))
|
23
35
|
unless Sidekiq.history_max_count == false
|
24
|
-
conn.
|
36
|
+
conn.zremrangebyrank(LIST_KEY, 0, -(Sidekiq.history_max_count + 1))
|
25
37
|
end
|
26
38
|
end
|
27
39
|
|
@@ -12,11 +12,25 @@ module Sidekiq
|
|
12
12
|
render(:erb, File.read("#{ROOT}/views/history.erb"))
|
13
13
|
end
|
14
14
|
|
15
|
-
app.post
|
15
|
+
app.post '/history/remove' do
|
16
16
|
Sidekiq::History.reset_history(counter: params['counter'])
|
17
17
|
redirect("#{root_path}history")
|
18
18
|
end
|
19
19
|
|
20
|
+
app.get '/filter/history' do
|
21
|
+
return redirect "#{root_path}history" unless params[:substr]
|
22
|
+
|
23
|
+
@messages = search(HistorySet.new, params[:substr])
|
24
|
+
render(:erb, File.read("#{ROOT}/views/history.erb"))
|
25
|
+
end
|
26
|
+
|
27
|
+
app.post '/filter/history' do
|
28
|
+
return redirect "#{root_path}history" unless params[:substr]
|
29
|
+
|
30
|
+
@messages = search(HistorySet.new, params[:substr])
|
31
|
+
render(:erb, File.read("#{ROOT}/views/history.erb"))
|
32
|
+
end
|
33
|
+
|
20
34
|
app.settings.locales << File.expand_path('locales', ROOT)
|
21
35
|
end
|
22
36
|
end
|
data/web/views/history.erb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-history
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Russ Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|