activerecord-pgtimeout 0.1.0 → 0.1.1

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
  SHA1:
3
- metadata.gz: c8aa74a8beb7f744fbd2f5d64a7ff91d690beae0
4
- data.tar.gz: 498a0a1f244c35fc1adb30d4a1d4239a782de6f1
3
+ metadata.gz: 158e3ddbec50c9abc515e46ce2f91b01295e7042
4
+ data.tar.gz: 0e66620adaaf2ff965598011dfec3894768c05bd
5
5
  SHA512:
6
- metadata.gz: f50d3ec09d7ca11a2f5603e613010ba4dddbeab55e9a5051cb0979c7c962614dab785a8e7de465dcabd3bb488267632664b431bde88bf742bd8a6a8e5d7d3456
7
- data.tar.gz: 64ffcfa9c824b57e87195c86cb3f1f0cd1f6a00514c99c3b3b7750717551bc92256950c314f2ea3baa8a10bc136b83309b1cf08b93b24d5162672d8f25026edf
6
+ metadata.gz: 40de913461dc49a6ce2174710a90ef2c3355aa4c77a914ae13912c10d95bcbad690cb5a07d99a62e0dfb5c9b5627f17c5669d46bcac4796fce3d952f3c1de40b
7
+ data.tar.gz: bc3b384b58b9cd5ee0a439535d7cb3e9ee841aec5a12ec2740141968b5b9e6d78e248eb5c4647718777fad5b7aeeb39ef5b1fa8dd58cb347fa9b3a2661d3e41d
@@ -4,14 +4,13 @@ module ActiveRecord
4
4
  class PgTimeout
5
5
  attr_reader :timeout
6
6
 
7
- def initialize(timeout, connection = ActiveRecord::Base.connection)
8
- @connection = connection
7
+ def initialize(timeout)
9
8
  @timeout = timeout
10
9
  end
11
10
 
12
- def execute(timeoutable_action, on_timeout)
13
- @connection.transaction do
14
- @connection.execute("set local statement_timeout to '#{timeout.to_i}ms'")
11
+ def execute(timeoutable_action, on_timeout, connection = ActiveRecord::Base.connection)
12
+ connection.transaction do
13
+ connection.execute("set local statement_timeout to '#{timeout.to_i}ms'")
15
14
  timeoutable_action.()
16
15
  end
17
16
 
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  class PgTimeout
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-pgtimeout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diogo Biazus