evt-message_store-postgres 0.11.1.3 → 0.11.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/message_store/postgres/session.rb +12 -10
- 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: 694338b82de9ecf14cd0f86732ea184de0e55dc4549162979d8e7ad25003444d
|
4
|
+
data.tar.gz: 25edc8a86ec1d1f58953da6d66e6b4a701ffab939f3d100a6a1ffd93b39a0de0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ffa232583267d460b2b7433dca816ce0e23a58b6f2fddfe2f320fff7de03ddb26b688c4ac86a9b01c454d85f05e863e881f38c50229065d2893d18ffb5da06f
|
7
|
+
data.tar.gz: 17ebe30d8c2ecae5a3af452d23311288ccf4cf72c74f923bebe1f18111747e453a49eb4c79b315bbfce439d4dd8bde8fc5e7999e13cf8bf392203b2b0763d5a3
|
@@ -28,7 +28,9 @@ module MessageStore
|
|
28
28
|
attr_name ||= :session
|
29
29
|
|
30
30
|
if session != nil && settings != nil
|
31
|
-
|
31
|
+
error_msg = "Session configured with both settings and session arguments. Use one or the other, but not both."
|
32
|
+
logger.error(tag: :session) { error_msg }
|
33
|
+
raise Error, error_msg
|
32
34
|
end
|
33
35
|
|
34
36
|
instance = session || build(settings: settings)
|
@@ -37,18 +39,18 @@ module MessageStore
|
|
37
39
|
end
|
38
40
|
|
39
41
|
def open
|
40
|
-
logger.trace { "Connecting to database" }
|
42
|
+
logger.trace(tag: :session) { "Connecting to database" }
|
41
43
|
|
42
44
|
if connected?
|
43
|
-
logger.debug { "Already connected. A new connection will not be built." }
|
45
|
+
logger.debug(tag: :session) { "Already connected. A new connection will not be built." }
|
44
46
|
return connection
|
45
47
|
end
|
46
48
|
|
47
|
-
logger.debug { "Not connected. A new connection will be built." }
|
49
|
+
logger.debug(tag: :session) { "Not connected. A new connection will be built." }
|
48
50
|
connection = self.class.build_connection(self)
|
49
51
|
self.connection = connection
|
50
52
|
|
51
|
-
logger.debug { "Connected to database" }
|
53
|
+
logger.debug(tag: :session) { "Connected to database" }
|
52
54
|
|
53
55
|
connection
|
54
56
|
end
|
@@ -56,12 +58,12 @@ module MessageStore
|
|
56
58
|
|
57
59
|
def self.build_connection(instance)
|
58
60
|
settings = instance.settings
|
59
|
-
logger.trace { "Building new connection to database (Settings: #{LogText.settings(settings).inspect})" }
|
61
|
+
logger.trace(tag: :session) { "Building new connection to database (Settings: #{LogText.settings(settings).inspect})" }
|
60
62
|
|
61
63
|
connection = PG::Connection.open(settings)
|
62
64
|
connection.type_map_for_results = PG::BasicTypeMapForResults.new(connection)
|
63
65
|
|
64
|
-
logger.
|
66
|
+
logger.debug(tag: :session) { "Built new connection to database (Settings: #{LogText.settings(settings).inspect})" }
|
65
67
|
|
66
68
|
connection
|
67
69
|
end
|
@@ -90,7 +92,7 @@ module MessageStore
|
|
90
92
|
end
|
91
93
|
|
92
94
|
def execute(sql_command, params=nil)
|
93
|
-
logger.trace { "Executing SQL command" }
|
95
|
+
logger.trace(tag: :session) { "Executing SQL command" }
|
94
96
|
logger.trace(tag: :sql) { sql_command }
|
95
97
|
logger.trace(tag: :data) { params.pretty_inspect }
|
96
98
|
|
@@ -100,11 +102,11 @@ module MessageStore
|
|
100
102
|
|
101
103
|
if params.nil?
|
102
104
|
connection.exec(sql_command).tap do
|
103
|
-
logger.debug { "Executed SQL command (no params)" }
|
105
|
+
logger.debug(tag: :session) { "Executed SQL command (no params)" }
|
104
106
|
end
|
105
107
|
else
|
106
108
|
connection.exec_params(sql_command, params).tap do
|
107
|
-
logger.debug { "Executed SQL command with params" }
|
109
|
+
logger.debug(tag: :session) { "Executed SQL command with params" }
|
108
110
|
end
|
109
111
|
end
|
110
112
|
end
|