Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
30a85023
Commit
30a85023
authored
9 years ago
by
Allen Gilliland
Browse files
Options
Downloads
Patches
Plain Diff
style tweaks.
parent
ffd0fc83
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/driver/generic_sql.clj
+4
-7
4 additions, 7 deletions
src/metabase/driver/generic_sql.clj
src/metabase/events/driver_notifications.clj
+6
-6
6 additions, 6 deletions
src/metabase/events/driver_notifications.clj
with
10 additions
and
13 deletions
src/metabase/driver/generic_sql.clj
+
4
−
7
View file @
30a85023
...
...
@@ -109,7 +109,7 @@
(
when-let
[
pool
(
get
@
connection-pools
id
)]
(
log/debug
(
u/format-color
'red
"Closing connection pool for database %d ..."
id
))
;; remove the cached reference to the pool so we don't try to use it anymore
(
reset
!
connection-pools
(
dissoc
@
connection-pools
id
)
)
(
swap
!
connection-pools
dissoc
id
)
;; now actively shut down the pool so that any open connections are closed
(
.close
^
ComboPooledDataSource
(
:datasource
pool
))))
...
...
@@ -120,12 +120,9 @@
(
if
(
contains?
@
connection-pools
id
)
;; we have an existing pool for this database, so use it
(
get
@
connection-pools
id
)
;; need to create a new pool
(
let
[
new-pool
(
create-connection-pool
database
)]
;; add the newly created pool to the cache so we maintain a reference to it
(
reset!
connection-pools
(
assoc
@
connection-pools
id
new-pool
))
;; just return the newly created pool
new-pool
)))
;; create a new pool and add it to our cache, then return it
(
u/prog1
(
create-connection-pool
database
)
(
swap!
connection-pools
assoc
id
<>
))))
(
defn
db->jdbc-connection-spec
"Return a JDBC connection spec for DATABASE. Normally this will have a C3P0 pool as its datasource, unless the database is `short-lived`."
...
...
This diff is collapsed.
Click to expand it.
src/metabase/events/driver_notifications.clj
+
6
−
6
View file @
30a85023
...
...
@@ -7,7 +7,7 @@
[
metabase.models.database
:refer
[
Database
]]))
(
def
^
:const
driver-notifications-topics
(
def
^
:const
^
:private
driver-notifications-topics
"The `Set` of event topics which are subscribed to for use in driver notifications."
#
{
:database-update
})
...
...
@@ -23,12 +23,12 @@
"Handle processing for a single event notification received on the driver-notifications-channel"
[
driver-notifications-event
]
;; try/catch here to prevent individual topic processing exceptions from bubbling up. better to handle them here.
(
try
(
when-let
[{
topic
:topic
database
:item
}
driver-notifications-event
]
(
when-let
[{
topic
:topic
database
:item
}
driver-notifications-event
]
(
try
;; notify the appropriate driver about the updated database
(
driver/notify-database-updated
(
driver/engine->driver
(
:engine
database
))
database
)
)
(
catch
Throwable
e
(
log/warn
(
format
"Failed to process driver notifications event. %s"
(
:topic
driver-notifications-event
))
e
))))
(
driver/notify-database-updated
(
driver/engine->driver
(
:engine
database
))
database
)
(
catch
Throwable
e
(
log/warn
(
format
"Failed to process driver notifications event. %s"
(
:topic
driver-notifications-event
))
e
))))
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment