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
ead957f7
Unverified
Commit
ead957f7
authored
5 years ago
by
Cam Saul
Browse files
Options
Downloads
Plain Diff
Merge branch 'release-0.33.x' into merge-release-0.33.x->master
parents
ea5b6a6b
61e6bccb
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitignore
+4
-7
4 additions, 7 deletions
.gitignore
src/metabase/util.clj
+29
-14
29 additions, 14 deletions
src/metabase/util.clj
with
33 additions
and
21 deletions
.gitignore
+
4
−
7
View file @
ead957f7
...
...
@@ -9,8 +9,6 @@
.DS_Store
.\#*
.eastwood
.eastwood
.idea/
.idea/
.nrepl-port
.vscode
...
...
@@ -31,10 +29,12 @@
/classes
/coverage
/crate-*
/cypress
/deploy/artifacts/*
/docs/uberdoc.html
/lein-plugins/*/target
/local/src
/local/src
/locales/metabase-*.pot
/modules/drivers/*/target
/node_modules/
...
...
@@ -43,9 +43,11 @@
/reset-password-artifacts
/resources/frontend_client/app/dist/
/resources/frontend_client/app/locales
/resources/frontend_client/app/locales
/resources/frontend_client/embed.html
/resources/frontend_client/index.html
/resources/frontend_client/public.html
/resources/namespaces.edn
/resources/sample-dataset.db.trace.db
/resources/version.properties
/screenshots
...
...
@@ -67,8 +69,3 @@ profiles.clj
target/checksum.txt
xcshareddata
xcuserdata
/resources/frontend_client/app/locales
*.iml
.idea/
/local/src
/cypress
This diff is collapsed.
Click to expand it.
src/metabase/util.clj
+
29
−
14
View file @
ead957f7
...
...
@@ -10,6 +10,7 @@
[
clojure.math.numeric-tower
:as
math
]
[
clojure.tools.logging
:as
log
]
[
clojure.tools.namespace.find
:as
ns-find
]
[
clojure.tools.reader.edn
:as
edn
]
[
colorize.core
:as
colorize
]
[
flatland.ordered.map
:refer
[
ordered-map
]]
[
medley.core
:as
m
]
...
...
@@ -454,22 +455,36 @@
(
or
(
id
object-or-id
)
(
throw
(
Exception.
(
tru
"Not something with an ID: {0}"
object-or-id
)))))
(
defn-
namespace-symbs*
[]
(
for
[
ns-symb
(
ns-find/find-namespaces
(
concat
(
classpath/system-classpath
)
(
classpath/classpath
(
classloader/the-classloader
))))
:when
(
and
(
.startsWith
(
name
ns-symb
)
"metabase."
)
(
not
(
.contains
(
name
ns-symb
)
"test"
)))]
ns-symb
))
(
defn-
metabase-namespace-symbs*
[]
(
vec
(
sort
(
for
[
ns-symb
(
ns-find/find-namespaces
(
classpath/system-classpath
))
:when
(
and
(
.startsWith
(
name
ns-symb
)
"metabase."
)
(
not
(
.contains
(
name
ns-symb
)
"test"
)))]
ns-symb
))))
(
def
^
:private
namespace-symbs-filename
"resources/namespaces.edn"
)
(
when
*compile-files*
(
printf
"Saving list of Metabase namespaces to %s...\n"
namespace-symbs-filename
)
(
spit
namespace-symbs-filename
(
with-out-str
(
pprint
(
metabase-namespace-symbs*
)))))
(
def
metabase-namespace-symbols
"Delay to a vector of symbols of all Metabase namespaces, excluding test namespaces.
This is intended for use by various routines that load related namespaces, such as task and events initialization.
Using `ns-find/find-namespaces` is fairly slow, and can take as much as half a second to iterate over the thousand
or so namespaces that are part of the Metabase project; use this instead for a massive performance increase."
;; We want to give JARs in the ./plugins directory a chance to load. At one point we have this as a future so it
;; start looking for things in the background while other stuff is happening but that meant plugins couldn't
;; introduce new Metabase namespaces such as drivers.
(
delay
(
vec
(
namespace-symbs*
))))
"Delay to a vector of symbols of all Metabase namespaces, excluding test namespaces. This is intended for use by
various routines that load related namespaces, such as task and events initialization."
;; When building the uberjar we'll determine the symbols ahead of time ans save to an EDN file which will speed up
;; initialization a bit and also fix an issue where the sequence would be empty if `:omit-source` was enabled.
;; `ns-find` looks for Clojure source files.
;;
;; Use a delay for dev runs since `ns-find` is slow and can take several seconds or more
(
if
config/is-prod?
(
delay
(
try
(
log/info
(
trs
"Reading Metabase namespaces from {0}"
namespace-symbs-filename
))
(
edn/read-string
(
slurp
namespace-symbs-filename
))
(
catch
Throwable
e
(
log/error
e
(
trs
"Failed to read Metabase namespaces from {0}"
namespace-symbs-filename
))
(
metabase-namespace-symbs*
))))
(
delay
(
metabase-namespace-symbs*
))))
(
def
^
java.util.regex.Pattern
uuid-regex
"A regular expression for matching canonical string representations of UUIDs."
...
...
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