sidekiq-redislog 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sidekiq-redislog (0.0.6)
4
+ sidekiq-redislog (0.0.7)
5
5
  sidekiq (>= 2.2.1)
6
6
  sinatra
7
7
  slim
data/README.md CHANGED
@@ -44,14 +44,11 @@ Released under the MIT License. See the [LICENSE][license] file for further deta
44
44
 
45
45
  ## TODO
46
46
 
47
- - XHR polling (< IE8 etc.)
48
47
  - Connect/Disconnect buttons since it consumes a thread for the poller.
49
48
 
50
49
 
51
50
  ## Notes
52
51
 
53
- If you mount sidekiq to a non-standard route ie. mount Sidekiq::Web => '/admin/sidekiq' then you'll have to
54
- redirect the stream url (which javascript hits via SSE):
55
- ```match '/sidekiq/redis_log_stream' => redirect('/admin/sidekiq/redis_log_stream')```
56
- in ```routes.rb```
52
+ If you mount sidekiq to a non-standard route ie. mount Sidekiq::Web => '/admin/sidekiq' it will automatically
53
+ handle remapping of the stream URI.
57
54
 
@@ -2,11 +2,11 @@ module Sinatra
2
2
  module RedisLogHelper
3
3
  def set_sse_headers response
4
4
 
5
- response.headers.delete('Content-Length') # no content length
6
- response.headers['X-Accel-Buffering'] = 'no' # for nginx
7
- response.headers["Connection"] = "keepalive" #optimisation
8
- response.headers["Cache-Control"] = "no-cache, no-store" #important for browsers
9
- response.headers['Last-Modified'] = Time.now.to_s # #fixes buffering
5
+ response.headers.delete('Content-Length') # no content length
6
+ response.headers['X-Accel-Buffering'] = 'no' # for nginx
7
+ response.headers["Connection"] = "keepalive" # optimisation
8
+ response.headers["Cache-Control"] = "no-cache, no-store" # important for browsers
9
+ response.headers['Last-Modified'] = Time.now.to_s # fixes buffering
10
10
 
11
11
  end
12
12
 
@@ -33,7 +33,6 @@ module Sinatra
33
33
  end
34
34
 
35
35
  config
36
-
37
36
  end
38
37
  end
39
38
  end
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module RedisLog
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
@@ -7,12 +7,11 @@
7
7
  var show_logs_for = function(event_channel, event_id, log_id) {
8
8
 
9
9
  if (!!window.EventSource) {
10
- source = new EventSource(event_channel); // match routes.rb
11
-
12
- element = document.getElementById(log_id); // match template
10
+ var element = document.getElementById(log_id); // match view template
11
+ source = new EventSource(event_channel); // match routes.rb
13
12
 
14
13
  source.addEventListener(event_id, function(e) {
15
- //firefox has no 'data'
14
+ // firefox has no 'data'
16
15
  if (e.data) data = e.data; else data = e;
17
16
 
18
17
  element.innerHTML += data + "\n";
@@ -20,10 +19,13 @@
20
19
  });
21
20
  }
22
21
  else {
23
- // Result to xhr polling :( TODO
22
+ if (console && console.log) {
23
+ console.log('Sorry - This browser does not support server-sent events (SSE).');
24
+ }
24
25
  }
25
26
  };
26
27
 
27
- show_logs_for('/sidekiq/redis_log_stream', 'redis_log', 'logger')
28
+ var stream_path = document.location.pathname + '_log_stream';
29
+ show_logs_for(stream_path, 'redis_log', 'logger');
28
30
 
29
31
  </script>
@@ -8,12 +8,11 @@ javascript:
8
8
  var show_logs_for = function(event_channel, event_id, log_id) {
9
9
 
10
10
  if (!!window.EventSource) {
11
- source = new EventSource(event_channel); // match routes.rb
12
-
13
- element = document.getElementById(log_id); // match template
11
+ var element = document.getElementById(log_id); // match view template
12
+ source = new EventSource(event_channel); // match routes.rb
14
13
 
15
14
  source.addEventListener(event_id, function(e) {
16
- //firefox has no 'data'
15
+ // firefox has no 'data'
17
16
  if (e.data) data = e.data; else data = e;
18
17
 
19
18
  element.innerHTML += data + "\n";
@@ -21,9 +20,12 @@ javascript:
21
20
  });
22
21
  }
23
22
  else {
24
- // Result to xhr polling :( TODO
23
+ if (console && console.log) {
24
+ console.log('Sorry - This browser does not support server-sent events (SSE).');
25
+ }
25
26
  }
26
27
  };
27
28
 
28
- show_logs_for('/sidekiq/redis_log_stream', 'redis_log', 'logger')
29
+ var stream_path = document.location.pathname + '_log_stream';
30
+ show_logs_for(stream_path, 'redis_log', 'logger');
29
31
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-redislog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
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: 2013-09-26 00:00:00.000000000 Z
12
+ date: 2013-10-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sidekiq
@@ -146,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
146
146
  version: '0'
147
147
  segments:
148
148
  - 0
149
- hash: -1763261188821529237
149
+ hash: 1548494212431323022
150
150
  required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  none: false
152
152
  requirements:
@@ -155,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
155
  version: '0'
156
156
  segments:
157
157
  - 0
158
- hash: -1763261188821529237
158
+ hash: 1548494212431323022
159
159
  requirements: []
160
160
  rubyforge_project:
161
161
  rubygems_version: 1.8.25