super_settings 2.4.2 → 2.4.3
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 +8 -1
- data/VERSION +1 -1
- data/lib/super_settings/storage/active_record_storage/models.rb +6 -18
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6383a79b3768e7e5f0740c3c8d6311301376a9228ab9270f6b67b4eb7b99d886
|
|
4
|
+
data.tar.gz: fd6b3704596f693e41bb83a7b9face1ebfcd282ffeabc03eacf6124708bbddc7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8c0799047ef89481db3805e1ea017d10e1442c6328fad3ad64548734d8ff35cdab3e2691924937759949e2b87b7bd4da92976c70b225e881edc4e2d875458710
|
|
7
|
+
data.tar.gz: 8beaf6a047e308de38a598772e56b5827353e1b8419dfcf85d5ab86699b76b1c180a93332115acff3752f0ad5b6d7c290aed79908e8933e5c6d999912fb34294
|
data/CHANGELOG.md
CHANGED
|
@@ -4,9 +4,16 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## 2.4.3
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Model.availability? return false when the connection isn't established or there is no database.
|
|
12
|
+
|
|
13
|
+
|
|
7
14
|
## 2.4.2
|
|
8
15
|
|
|
9
|
-
###
|
|
16
|
+
### Fixed
|
|
10
17
|
|
|
11
18
|
- Model.availability? can return false when connection pool connection exists for active record storage
|
|
12
19
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.4.
|
|
1
|
+
2.4.3
|
|
@@ -15,28 +15,16 @@ module SuperSettings
|
|
|
15
15
|
|
|
16
16
|
class << self
|
|
17
17
|
# ActiveRecord storage is only available if the connection pool is connected and the table exists.
|
|
18
|
-
def available?
|
|
19
|
-
attempt_connection!
|
|
20
|
-
connection_pool.with_connection { table_exists? }
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
private
|
|
24
|
-
|
|
25
|
-
@connection_attempted = false
|
|
26
|
-
|
|
27
|
-
def attempt_connection!
|
|
28
|
-
return if @connection_attempted
|
|
29
|
-
|
|
30
|
-
@connection_attempted = true
|
|
31
|
-
return if connection_pool.nil? || connection_pool.connected?
|
|
32
18
|
|
|
19
|
+
def available?
|
|
33
20
|
begin
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
rescue ActiveRecord::ConnectionNotEstablished
|
|
21
|
+
# table_exists? will attempt to retrieve a connection from the pool and load the schema_cache
|
|
22
|
+
# which is memoized per connection. If there is no database or connection, it will raise an error.
|
|
23
|
+
table_exists?
|
|
24
|
+
rescue ActiveRecord::NoDatabaseError, ActiveRecord::ConnectionNotEstablished
|
|
38
25
|
# Ignore errors so the application doesn't break if the database is not available.
|
|
39
26
|
# Otherwise things like build processes can fail.
|
|
27
|
+
false
|
|
40
28
|
end
|
|
41
29
|
end
|
|
42
30
|
end
|