sidekiq-benchmark 0.7.1 → 0.7.3

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
  SHA256:
3
- metadata.gz: e90aa6b3895541db3454bfac34902d919c5f9c5e8f6640085690af9530fe9995
4
- data.tar.gz: 7a88366e826fc84954c47296294d4685cf5887bfa2bbea0fe4f966e917d28f95
3
+ metadata.gz: 05ca155712f4d25af211627b1d7676b41ddff6c34e29d2c396607508d7959aa7
4
+ data.tar.gz: 8d458d2b8642b44e45aea45ecca27dd5136f0436c43e3ce9097d705b6fd54254
5
5
  SHA512:
6
- metadata.gz: a7f05db5120b717567fc6f2c110ed5d1c4873ff35989f2c5a61c9c6317068c3e5a195ece0c504581c8d33a90f0aad5fc3e0e685265d10cffb9c61e037428e592
7
- data.tar.gz: 690b2c9f0786eb23b0a6288d4f68008085e4917a205cccf016218cdb5a080cfbc94808403bb37d34f1d46c34107e1ec67c1103c190690272dc7f45b0eae4036d
6
+ metadata.gz: aabb9212f2477a564a59b45eb73d4c8d59de726db640118615d99d6f30269e14912d55b7cb5d6890d3e16fadb8ceca675f568574d8f1c8c3e0d4dc37b259e0f3
7
+ data.tar.gz: 9b16419856878d0377e97413e0fdb18642c23fcdb84eaf35a081fe9b7a1e36535a69a99cc6102639ecf1dc457dc9d3e81e4fd8ec7365dea0eaaece158fbd695d
@@ -0,0 +1,71 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ ruby-latest:
14
+ runs-on: ubuntu-latest
15
+ container: ruby:latest
16
+ services:
17
+ redis:
18
+ image: redis
19
+ options: >-
20
+ --health-cmd "redis-cli ping"
21
+ --health-interval 10s
22
+ --health-timeout 5s
23
+ --health-retries 5
24
+ steps:
25
+ - uses: actions/checkout@v3
26
+ - name: bundle install
27
+ run: bundle install
28
+ - name: run tests
29
+ run: bundle exec rake test
30
+ env:
31
+ REDIS_HOST: redis
32
+ ruby-latest-sidekiq-6:
33
+ runs-on: ubuntu-latest
34
+ container: ruby:latest
35
+ services:
36
+ redis:
37
+ image: redis
38
+ options: >-
39
+ --health-cmd "redis-cli ping"
40
+ --health-interval 10s
41
+ --health-timeout 5s
42
+ --health-retries 5
43
+ steps:
44
+ - uses: actions/checkout@v3
45
+ - name: bundle install
46
+ run: bundle install
47
+ - name: appraisal install
48
+ run: bundle exec appraisal install
49
+ - name: run tests
50
+ run: bundle exec appraisal sidekiq-6 rake test
51
+ env:
52
+ REDIS_HOST: redis
53
+ ruby-2:
54
+ runs-on: ubuntu-latest
55
+ container: ruby:2
56
+ services:
57
+ redis:
58
+ image: redis
59
+ options: >-
60
+ --health-cmd "redis-cli ping"
61
+ --health-interval 10s
62
+ --health-timeout 5s
63
+ --health-retries 5
64
+ steps:
65
+ - uses: actions/checkout@v3
66
+ - name: bundle install
67
+ run: bundle install
68
+ - name: run tests
69
+ run: bundle exec rake test
70
+ env:
71
+ REDIS_HOST: redis
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  vendor/
2
2
  Gemfile.lock
3
3
  coverage/
4
+ gemfiles
4
5
  *.gem
data/Appraisals ADDED
@@ -0,0 +1,7 @@
1
+ appraise 'sidekiq-7' do
2
+ gem 'sidekiq', '> 7'
3
+ end
4
+
5
+ appraise 'sidekiq-6' do
6
+ gem 'sidekiq', '~> 6'
7
+ end
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in sidekiq-benchmark.gemspec
4
4
  gemspec
5
+
6
+ gem "sidekiq", "> 5"
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Sidekiq::Benchmark
2
- [![Gem Version](https://badge.fury.io/rb/sidekiq-benchmark.png)](https://rubygems.org/gems/sidekiq-benchmark)
3
- [![Code Climate](https://codeclimate.com/github/kosmatov/sidekiq-benchmark.png)](https://codeclimate.com/github/kosmatov/sidekiq-benchmark)
4
- [![Build Status](https://travis-ci.org/kosmatov/sidekiq-benchmark.png)](https://travis-ci.org/kosmatov/sidekiq-benchmark)
5
- [![Coverage Status](https://coveralls.io/repos/kosmatov/sidekiq-benchmark/badge.png?branch=master)](https://coveralls.io/r/kosmatov/sidekiq-benchmark)
2
+ [![Gem Version](https://badge.fury.io/rb/sidekiq-benchmark.svg)](https://badge.fury.io/rb/sidekiq-benchmark)
3
+ [![Ruby](https://github.com/kosmatov/sidekiq-benchmark/actions/workflows/ruby.yml/badge.svg)](https://github.com/kosmatov/sidekiq-benchmark/actions/workflows/ruby.yml)
6
4
 
7
5
  Adds benchmarking methods to
8
6
  [Sidekiq](https://github.com/mperham/sidekiq) workers, keeps metrics and adds tab to Web UI to let you browse them.
@@ -15,11 +13,9 @@ Add this line to your application's Gemfile:
15
13
 
16
14
  And then execute:
17
15
 
18
- $ bundle
19
-
20
- ## Requirements
21
-
22
- From version 0.5.0 works with Sidekiq 4.2 or newer
16
+ ```shell
17
+ bundle
18
+ ```
23
19
 
24
20
  ## Usage
25
21
 
@@ -71,10 +67,6 @@ end
71
67
 
72
68
  ![Web UI](https://github.com/kosmatov/sidekiq-benchmark/raw/master/examples/web-ui.png)
73
69
 
74
- ### Sample Apps
75
-
76
- [Heroku App](http://sidekiq-benchmark.herokuapp.com/benchmarks/generate)
77
-
78
70
  ## Testing sidekiq workers
79
71
 
80
72
  When you use [Sidekiq::Testing](https://github.com/mperham/sidekiq/wiki/Testing) you
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Benchmark
3
- VERSION = "0.7.1"
3
+ VERSION = "0.7.3"
4
4
  end
5
5
  end
@@ -79,18 +79,18 @@ module Sidekiq
79
79
  job_time_key = @metrics[:job_time].round(1)
80
80
 
81
81
  Sidekiq.redis do |conn|
82
- conn.multi do
82
+ conn.multi do |transaction|
83
83
  @metrics.each do |key, value|
84
- conn.hincrbyfloat redis_keys[:total], key, value
84
+ transaction.hincrbyfloat redis_keys[:total], key, value
85
85
  end
86
86
 
87
- conn.hincrby redis_keys[:stats], job_time_key, 1
87
+ transaction.hincrby redis_keys[:stats], job_time_key, 1
88
88
 
89
- conn.hsetnx redis_keys[:total], "start_time", start_time
90
- conn.hset redis_keys[:total], "finish_time", finish_time
89
+ transaction.hsetnx redis_keys[:total], "start_time", start_time.to_s
90
+ transaction.hset redis_keys[:total], "finish_time", finish_time.to_s
91
91
 
92
- conn.expire redis_keys[:stats], REDIS_KEYS_TTL
93
- conn.expire redis_keys[:total], REDIS_KEYS_TTL
92
+ transaction.expire redis_keys[:stats], REDIS_KEYS_TTL
93
+ transaction.expire redis_keys[:total], REDIS_KEYS_TTL
94
94
  end
95
95
  end
96
96
  end
@@ -27,4 +27,5 @@ Gem::Specification.new do |gem|
27
27
  gem.add_development_dependency "coveralls"
28
28
  gem.add_development_dependency "pry"
29
29
  gem.add_development_dependency 'delorean', '~> 2.1'
30
+ gem.add_development_dependency 'appraisal'
30
31
  end
data/test/lib/web_test.rb CHANGED
@@ -3,6 +3,8 @@ require 'test_helper'
3
3
  module Sidekiq
4
4
  module Benchmark
5
5
  module Test
6
+ TOKEN = SecureRandom.base64(32).freeze
7
+
6
8
  describe "Web extention" do
7
9
  include Rack::Test::Methods
8
10
 
@@ -11,6 +13,8 @@ module Sidekiq
11
13
  end
12
14
 
13
15
  before do
16
+ env 'rack.session', { csrf: TOKEN }
17
+ env 'HTTP_X_CSRF_TOKEN', TOKEN
14
18
  Test.flush_db
15
19
  end
16
20
 
data/test/test_helper.rb CHANGED
@@ -1,26 +1,28 @@
1
1
  require 'minitest/autorun'
2
2
  require 'minitest/pride'
3
3
 
4
- require 'coveralls'
5
- Coveralls.wear! do
6
- add_filter '/test/'
7
- end
8
-
9
4
  ENV['RACK_ENV'] = 'test'
5
+ $TESTING = true
10
6
 
11
7
  require 'bundler/setup'
12
8
  require 'rack/test'
13
9
 
14
10
  require 'sidekiq'
15
- require 'sidekiq/util'
16
11
  require 'sidekiq-benchmark'
17
12
 
18
13
  require 'delorean'
19
14
  require 'pry'
20
15
 
21
- REDIS = Sidekiq::RedisConnection.create url: "redis://#{ENV['REDIS_HOST'] || 'localhost'}/15"
22
16
  Bundler.require
23
17
 
18
+ Sidekiq.configure_server do |cfg|
19
+ cfg.redis = {url: "redis://#{ENV['REDIS_HOST'] || 'localhost'}/15"}
20
+ end
21
+
22
+ Sidekiq.configure_client do |cfg|
23
+ cfg.redis = {url: "redis://#{ENV['REDIS_HOST'] || 'localhost'}/15"}
24
+ end
25
+
24
26
  module Sidekiq
25
27
  module Benchmark
26
28
  module Test
@@ -89,7 +91,6 @@ module Sidekiq
89
91
  end
90
92
 
91
93
  def self.flush_db
92
- Sidekiq.redis = REDIS
93
94
  Sidekiq.redis do |conn|
94
95
  conn.flushdb
95
96
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-benchmark
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Kosmatov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-30 00:00:00.000000000 Z
11
+ date: 2022-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chartkick
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '2.1'
125
+ - !ruby/object:Gem::Dependency
126
+ name: appraisal
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  description: Benchmarks for Sidekiq
126
140
  email:
127
141
  - key@kosmatov.ru
@@ -129,7 +143,9 @@ executables: []
129
143
  extensions: []
130
144
  extra_rdoc_files: []
131
145
  files:
146
+ - ".github/workflows/ruby.yml"
132
147
  - ".gitignore"
148
+ - Appraisals
133
149
  - Gemfile
134
150
  - LICENSE.txt
135
151
  - README.md
@@ -165,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
181
  - !ruby/object:Gem::Version
166
182
  version: '0'
167
183
  requirements: []
168
- rubygems_version: 3.1.2
184
+ rubygems_version: 3.3.26
169
185
  signing_key:
170
186
  specification_version: 4
171
187
  summary: Adds benchmarking methods to Sidekiq workers, keeps metrics and adds tab