sidekiq-benchmark 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e90aa6b3895541db3454bfac34902d919c5f9c5e8f6640085690af9530fe9995
4
- data.tar.gz: 7a88366e826fc84954c47296294d4685cf5887bfa2bbea0fe4f966e917d28f95
3
+ metadata.gz: 902591a0561ae44fdb12cd92c03fccf1777efc778e40a03a3886c7ed6775b9dd
4
+ data.tar.gz: 1b4af01f66959214362dc300fa17bfa4280e9a4d587e389738e77812efe46a76
5
5
  SHA512:
6
- metadata.gz: a7f05db5120b717567fc6f2c110ed5d1c4873ff35989f2c5a61c9c6317068c3e5a195ece0c504581c8d33a90f0aad5fc3e0e685265d10cffb9c61e037428e592
7
- data.tar.gz: 690b2c9f0786eb23b0a6288d4f68008085e4917a205cccf016218cdb5a080cfbc94808403bb37d34f1d46c34107e1ec67c1103c190690272dc7f45b0eae4036d
6
+ metadata.gz: 5c3d5ea526654c822157e9a1a6cafc1c81d04066ba66454bbee9f408706dcb32bdc7246e52b8fb3741afc01985e774b633b9c808745b4427524757752a7ba33f
7
+ data.tar.gz: d2c362f685871a55ca3bae38014f74bc75bbdcc1f0b33a462692e0e1c40dc807743a3f6efe74ed2ecb6faca88e3efb55901f0407e611f248d281be838b2cb010
@@ -0,0 +1,50 @@
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-2:
33
+ runs-on: ubuntu-latest
34
+ container: ruby:2
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: run tests
48
+ run: bundle exec rake test
49
+ env:
50
+ REDIS_HOST: redis
data/.gitignore CHANGED
@@ -2,3 +2,4 @@ vendor/
2
2
  Gemfile.lock
3
3
  coverage/
4
4
  *.gem
5
+ .gemkey
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.
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Benchmark
3
- VERSION = "0.7.1"
3
+ VERSION = "0.7.2"
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
90
+ transaction.hset redis_keys[:total], "finish_time", finish_time
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
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
@@ -7,6 +7,7 @@ Coveralls.wear! do
7
7
  end
8
8
 
9
9
  ENV['RACK_ENV'] = 'test'
10
+ $TESTING = true
10
11
 
11
12
  require 'bundler/setup'
12
13
  require 'rack/test'
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.2
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-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chartkick
@@ -129,6 +129,7 @@ executables: []
129
129
  extensions: []
130
130
  extra_rdoc_files: []
131
131
  files:
132
+ - ".github/workflows/ruby.yml"
132
133
  - ".gitignore"
133
134
  - Gemfile
134
135
  - LICENSE.txt
@@ -165,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
166
  - !ruby/object:Gem::Version
166
167
  version: '0'
167
168
  requirements: []
168
- rubygems_version: 3.1.2
169
+ rubygems_version: 3.3.7
169
170
  signing_key:
170
171
  specification_version: 4
171
172
  summary: Adds benchmarking methods to Sidekiq workers, keeps metrics and adds tab