pgdice 0.4.1 → 0.4.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 +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/pgdice.rb +2 -0
- data/lib/pgdice/database_connection_factory.rb +2 -1
- data/lib/pgdice/query_executor.rb +22 -0
- data/lib/pgdice/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ae586abaf672ced69ab9bab60300d99827b9b39363077c1ead5376c74823ba3
|
4
|
+
data.tar.gz: 5cd703d8edaaf0315e62a761ea1a34d7f8b9e07b7a9e5caa09505d16ce20030e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93ebdada6b6e423bb1b0befda9bae91b52d3e19b498c818d38dac31268f77b21462b75b17bfc4c95281915e38c786a8f16cc2297fb97090b1c2756730c4c8706
|
7
|
+
data.tar.gz: 8c25ece5a48b2972b0571de6be7a0a6912c193af0ad3193224b1946bf70b04f1771b6d209ccdb7e720aeeb9b53f4ae3ab74542de1bae22d33a17f11dd8e3c00b
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
|
5
|
+
## [v0.4.2] : 2019-04-22
|
6
|
+
### Changes
|
7
|
+
- Fix #19 where PgDice wouldn't recover from a broken PG::Connection
|
8
|
+
by adding new retry behavior
|
9
|
+
|
5
10
|
## [v0.4.1] : 2019-03-21
|
6
11
|
### Changes
|
7
12
|
- Fix bug where partitioning by months would break when the month was < 10
|
data/lib/pgdice.rb
CHANGED
@@ -10,7 +10,8 @@ module PgDice
|
|
10
10
|
|
11
11
|
def initialize(configuration, opts = {})
|
12
12
|
@configuration = configuration
|
13
|
-
@query_executor = opts[:query_executor] ||=
|
13
|
+
@query_executor = opts[:query_executor] ||= PgDice::QueryExecutor.new(logger: logger,
|
14
|
+
connection_supplier: -> { pg_connection })
|
14
15
|
end
|
15
16
|
|
16
17
|
def call
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Entry point for DatabaseConnection
|
4
|
+
module PgDice
|
5
|
+
# Wrapper class around pg_connection to reset connection on PG errors
|
6
|
+
class QueryExecutor
|
7
|
+
attr_reader :logger
|
8
|
+
|
9
|
+
def initialize(logger:, connection_supplier:)
|
10
|
+
@logger = logger
|
11
|
+
@connection_supplier = connection_supplier
|
12
|
+
end
|
13
|
+
|
14
|
+
def call(query)
|
15
|
+
@connection_supplier.call.exec(query)
|
16
|
+
rescue PG::Error => error
|
17
|
+
logger.error { "Caught error: #{error}. Going to reset connection and try again" }
|
18
|
+
@connection_supplier.call.reset
|
19
|
+
@connection_supplier.call.exec(query)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/pgdice/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pgdice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Newell
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -325,6 +325,7 @@ files:
|
|
325
325
|
- lib/pgdice/period_fetcher_factory.rb
|
326
326
|
- lib/pgdice/pg_slice_manager.rb
|
327
327
|
- lib/pgdice/pg_slice_manager_factory.rb
|
328
|
+
- lib/pgdice/query_executor.rb
|
328
329
|
- lib/pgdice/table.rb
|
329
330
|
- lib/pgdice/table_finder.rb
|
330
331
|
- lib/pgdice/validation.rb
|