sidekiq_snitch 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e93d050d1ec259c9f6999a0233af52290500260a
4
- data.tar.gz: 42b4633edb33029ff5d31c8023db288ede8617b6
3
+ metadata.gz: afe59b184d86c2b9e53b801c2917118b981bf6ce
4
+ data.tar.gz: 94bfcd206d8153a0cb3fceb59cef5b20ca44d746
5
5
  SHA512:
6
- metadata.gz: 3bd27cb05071385d4519c849a97c6035a3ef45fe1f8baf0c5613d300a9893a401885c2c6afdbdd6454ffbcd2888f40fa7a72a6fa72aa431911560c2d1ac1eb9d
7
- data.tar.gz: d692b4547d069c5d4fa3d6c3ed94731ff89f368400c159d166e509eddc87e26686b94a9d4eed4bc8b510451845318b183ced028e218dd8baae9430d88e58fb65
6
+ metadata.gz: 8bdb47a7a3434fd27dcf58ba6e1503835c36eb0034e570f33dd20d17438202e49cf08aae1341fed6cdb8cc760ee0d2cd99ab18560c00bddb44c48849fbe14095
7
+ data.tar.gz: f17618ac621eda69dacd3127913a1537c38902e24f4d50429b7254d3cf2ac07f4a952ea7dee2b2d280db42153f86ea839050456e8be8dfe2c38e1fb0fc493a58
data/Rakefile CHANGED
@@ -1,32 +1,4 @@
1
- begin
2
- require 'bundler/setup'
3
- rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
- end
6
-
7
- require 'rdoc/task'
8
-
9
- RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'SidekiqSnitch'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.rdoc')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
15
- end
16
-
17
-
18
-
19
-
20
- Bundler::GemHelper.install_tasks
21
-
22
- require 'rake/testtask'
23
-
24
- Rake::TestTask.new(:test) do |t|
25
- t.libs << 'lib'
26
- t.libs << 'test'
27
- t.pattern = 'test/**/*_test.rb'
28
- t.verbose = false
29
- end
30
-
31
-
32
- task default: :test
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+ RSpec::Core::RakeTask.new(:spec)
4
+ task default: :spec
@@ -13,7 +13,7 @@ module Sidekiq
13
13
  Net::HTTP.get(URI(ENV['SIDEKIQ_SNITCH_URL']))
14
14
 
15
15
  # groundhog day!
16
- Snitch.perform_in(1.hour)
16
+ Snitch.perform_in(1.hour) unless SidekiqSnitch.scheduled?
17
17
  end
18
18
  end
19
19
  end
@@ -1,14 +1,7 @@
1
- require 'sidekiq/api'
2
-
3
- # This initializer inspects the currently scheduled Sidekiq workers,
4
- # of which the Sidekiq::Snitch must always be one in a properly
5
- # configured application.
6
- #
7
- # When none are found, schedule one to run immediately. The worker
8
- # will then take care of rescheduling itself.
9
- set = Sidekiq::ScheduledSet.new
10
- already_scheduled = set.any? {|job| job.klass == "Sidekiq::Snitch" }
11
-
12
- if ! already_scheduled && ! ENV['SIDEKIQ_SNITCH_URL'].blank?
13
- Sidekiq::Snitch.perform_async
1
+ # Scheduled a Sidekiq::Snitch worker to monitor Sidekiq using
2
+ # Dead Man's Snitch (www.deadmanssnitch.com).
3
+ Sidekiq.configure_server do |config|
4
+ config.on(:startup) do
5
+ Sidekiq::Snitch.perform_async unless SidekiqSnitch.scheduled?
6
+ end
14
7
  end
@@ -1,4 +1,8 @@
1
1
  require "sidekiq_snitch/engine"
2
+ require 'sidekiq/api'
2
3
 
3
4
  module SidekiqSnitch
5
+ def self.scheduled?
6
+ Sidekiq::ScheduledSet.new.any? {|job| job.klass == "Sidekiq::Snitch" }
7
+ end
4
8
  end
@@ -1,3 +1,5 @@
1
+ require 'rails/engine'
2
+
1
3
  module SidekiqSnitch
2
4
  class Engine < ::Rails::Engine
3
5
  isolate_namespace SidekiqSnitch
@@ -1,3 +1,3 @@
1
1
  module SidekiqSnitch
2
- VERSION = "1.2.0"
2
+ VERSION = "1.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq_snitch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joost Baaij
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-20 00:00:00.000000000 Z
11
+ date: 2016-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -38,6 +38,62 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.5.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
41
97
  description: A Rails engine that monitors your Sidekiq install using Dead Man's Snitch
42
98
  (www.deadmanssnitch.com).
43
99
  email:
@@ -47,7 +103,6 @@ extensions: []
47
103
  extra_rdoc_files: []
48
104
  files:
49
105
  - MIT-LICENSE
50
- - README.rdoc
51
106
  - Rakefile
52
107
  - app/workers/sidekiq/snitch.rb
53
108
  - config/initializers/perform.rb
@@ -76,8 +131,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
131
  version: '0'
77
132
  requirements: []
78
133
  rubyforge_project:
79
- rubygems_version: 2.4.8
134
+ rubygems_version: 2.5.1
80
135
  signing_key:
81
136
  specification_version: 4
82
137
  summary: Monitor Sidekiq using Dead Mans's Snitch
83
138
  test_files: []
139
+ has_rdoc:
@@ -1,48 +0,0 @@
1
- = sidekiq_snitch
2
-
3
- Rails engine to monitor your Sidekiq queue using Dead Man's Snitch.
4
-
5
- = Installation
6
-
7
- First, create an account at Dead Man's Snitch http://www.deadmanssnitch.com/
8
-
9
- Then, create an hourly snitch. Put its value in ENV['SIDEKIQ_SNITCH_URL'].
10
-
11
- In Gemfile:
12
-
13
- gem 'sidekiq_snitch'
14
-
15
- and run `bundle`. Deploy et voila!
16
-
17
- = FAQ
18
-
19
- Question: Why use an external system and not a simple cron job?
20
-
21
- Answer: If you use Sidekiq to run tasks in the background, you should monitor it.
22
- Monitoring any system using the system itself is asking for trouble. Using an external
23
- tool that starts to yell when something is wrong is the most sensible thing to do.
24
-
25
- You can use any old monitoring tool, but we've found that Dead Man's Snitch is
26
- simple and does one thing really well. It's also very useful for monitoring cron, in
27
- fact.
28
-
29
- Question: What is ENV?
30
-
31
- Answer: create an initializer:
32
-
33
- ENV['SIDEKIQ_SNITCH_URL'] = "https://snitch.url.example.com"
34
-
35
- Question: Can I turn this off in my development environment?
36
-
37
- Answer: Sure! Just make sure there is no value set for ENV['SIDEKIQ_SNITCH_URL'].
38
- Sidekiq Snitch only runs if it has somewhere to snitch.
39
-
40
- = Created by
41
-
42
- Space Babies. www.spacebabies.nl
43
-
44
- Get in touch: joost@spacebabies.nl
45
-
46
- = License
47
-
48
- MIT.