shinq 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -1
- data/lib/shinq/cli.rb +5 -0
- data/lib/shinq/configuration.rb +2 -1
- data/shinq.gemspec +1 -1
- data/spec/db/structure.sql +6 -0
- data/spec/integration_spec.rb +4 -1
- data/spec/shinq/configuration_spec.rb +1 -0
- data/spec/shinq_spec.rb +4 -1
- data/spec/spec_helper.rb +11 -10
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01d64906303f1f93f1c58963b07d97b8d5f63ac7
|
4
|
+
data.tar.gz: 478a6b80464b1b399c19da69a8e37f4dc8dd7fbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b165ea04629a8dd68d9e2ea480a27cdd663d69530562721cc726e8ce360a86d61188b031dde01c7da7fbd35d8a639cd2d63441f39e947563043206ff3c82a077
|
7
|
+
data.tar.gz: 7d8bef34453211d6e7e9bf6abc1ba19c881b7a42552dc76146d65d6e96bff947d090eeb68929e58c229a2998126fbb670a95adef3416f6e304f3aee5c5f20f5e
|
data/.travis.yml
CHANGED
@@ -6,9 +6,11 @@ rvm:
|
|
6
6
|
- 2.2.0
|
7
7
|
- 2.2.1
|
8
8
|
- 2.2.2
|
9
|
+
- 2.2.7
|
10
|
+
- 2.3.4
|
11
|
+
- 2.4.1
|
9
12
|
gemfile:
|
10
13
|
- Gemfile
|
11
14
|
before_install:
|
12
15
|
- mysql -e "create database IF NOT EXISTS shinq_test;" -uroot
|
13
|
-
- mysql -e "use shinq_test; create table queue_test (job_id varchar(255) not null, title varchar(255), enqueued_at datetime not null);" -uroot
|
14
16
|
script: bundle exec rspec
|
data/lib/shinq/cli.rb
CHANGED
@@ -41,6 +41,10 @@ module Shinq
|
|
41
41
|
opts[:process] = v.to_i
|
42
42
|
end
|
43
43
|
|
44
|
+
opt.on('--graceful-kill-timeout VALUE', 'Seconds to SIGQUIT workers even during performing jobs') do |v|
|
45
|
+
opts[:graceful_kill_timeout] = v.to_i
|
46
|
+
end
|
47
|
+
|
44
48
|
opt.on('--queue-timeout VALUE', 'Waiting queue time(sec). use function of queue_wait(Q4M)') do |v|
|
45
49
|
opts[:queue_timeout] = v.to_i
|
46
50
|
end
|
@@ -108,6 +112,7 @@ module Shinq
|
|
108
112
|
worker_type: 'process',
|
109
113
|
pid_file: 'shinq.pid',
|
110
114
|
workers: options.process,
|
115
|
+
worker_graceful_kill_timeout: options.graceful_kill_timeout
|
111
116
|
logger: options.daemonize ? Shinq.logger : nil
|
112
117
|
})
|
113
118
|
|
data/lib/shinq/configuration.rb
CHANGED
@@ -10,11 +10,12 @@ module Shinq
|
|
10
10
|
# You may need to set it +false+ for jobs which take very long time to proceed.
|
11
11
|
# You may also need to handle performing error manually then.
|
12
12
|
class Configuration
|
13
|
-
attr_accessor :require, :worker_name, :worker_class, :db_config, :queue_db, :default_db, :process, :queue_timeout, :daemonize, :statistics, :lifecycle, :abort_on_error
|
13
|
+
attr_accessor :require, :worker_name, :worker_class, :db_config, :queue_db, :default_db, :process, :graceful_kill_timeout, :queue_timeout, :daemonize, :statistics, :lifecycle, :abort_on_error
|
14
14
|
|
15
15
|
DEFAULT = {
|
16
16
|
require: '.',
|
17
17
|
process: 1,
|
18
|
+
graceful_kill_timeout: 600,
|
18
19
|
queue_timeout: 1,
|
19
20
|
daemonize: false,
|
20
21
|
abort_on_error: true
|
data/shinq.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "shinq"
|
7
|
-
spec.version = '0.
|
7
|
+
spec.version = '0.8.0'
|
8
8
|
spec.authors = ["Ryoichi SEKIGUCHI"]
|
9
9
|
spec.email = ["ryopeko@gmail.com"]
|
10
10
|
spec.summary = %q{Worker and enqueuer for Q4M using the interface of ActiveJob.}
|
data/spec/integration_spec.rb
CHANGED
@@ -11,6 +11,7 @@ describe Shinq::Configuration do
|
|
11
11
|
it { is_expected.to respond_to(:queue_db) }
|
12
12
|
it { is_expected.to respond_to(:default_db) }
|
13
13
|
it { is_expected.to respond_to(:process) }
|
14
|
+
it { is_expected.to respond_to(:graceful_kill_timeout) }
|
14
15
|
it { is_expected.to respond_to(:queue_timeout) }
|
15
16
|
it { is_expected.to respond_to(:daemonize) }
|
16
17
|
it { is_expected.to respond_to(:statistics) }
|
data/spec/shinq_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -3,9 +3,13 @@ require 'simplecov'
|
|
3
3
|
require 'yaml'
|
4
4
|
require 'active_support/core_ext/hash'
|
5
5
|
|
6
|
-
|
6
|
+
def load_database_config
|
7
|
+
db_config = YAML.load_file(File.expand_path('./config/database.yml', __dir__)).symbolize_keys
|
8
|
+
end
|
9
|
+
|
10
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
|
7
11
|
SimpleCov::Formatter::HTMLFormatter
|
8
|
-
|
12
|
+
)
|
9
13
|
|
10
14
|
SimpleCov.start do
|
11
15
|
add_filter 'spec'
|
@@ -20,14 +24,11 @@ RSpec.configure do |config|
|
|
20
24
|
config.default_formatter = 'doc'
|
21
25
|
end
|
22
26
|
|
27
|
+
config.before(:suite) do
|
28
|
+
connection = Mysql2::Client.new(load_database_config[:test].merge(flags: Mysql2::Client::MULTI_STATEMENTS))
|
29
|
+
connection.query(File.read(File.expand_path('./db/structure.sql', __dir__)))
|
30
|
+
end
|
31
|
+
|
23
32
|
config.order = :random
|
24
33
|
Kernel.srand config.seed
|
25
34
|
end
|
26
|
-
|
27
|
-
def load_database_config(klass)
|
28
|
-
db_config = YAML.load_file(File.expand_path('./config/database.yml', __dir__)).symbolize_keys
|
29
|
-
klass.configuration = {
|
30
|
-
db_config: db_config,
|
31
|
-
default_db: :test
|
32
|
-
}
|
33
|
-
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shinq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryoichi SEKIGUCHI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -214,6 +214,7 @@ files:
|
|
214
214
|
- lib/shinq/statistics.rb
|
215
215
|
- shinq.gemspec
|
216
216
|
- spec/config/database.yml
|
217
|
+
- spec/db/structure.sql
|
217
218
|
- spec/integration_spec.rb
|
218
219
|
- spec/shinq/configuration_spec.rb
|
219
220
|
- spec/shinq_spec.rb
|
@@ -244,6 +245,7 @@ specification_version: 4
|
|
244
245
|
summary: Worker and enqueuer for Q4M using the interface of ActiveJob.
|
245
246
|
test_files:
|
246
247
|
- spec/config/database.yml
|
248
|
+
- spec/db/structure.sql
|
247
249
|
- spec/integration_spec.rb
|
248
250
|
- spec/shinq/configuration_spec.rb
|
249
251
|
- spec/shinq_spec.rb
|