Skip to content
Snippets Groups Projects
Unverified Commit 0c840ded authored by Cam Saul's avatar Cam Saul
Browse files

Fix plugins being able to introduce new Metabase namespaces (credit: @alexuf)

parent b6819782
No related branches found
No related tags found
No related merge requests found
......@@ -768,15 +768,15 @@
(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."
;; Actually we can go ahead and start doing this in the background once the app launches while other stuff is loading, so use a future here
;; This would be faster when running the *JAR* if we just did it at compile-time and made it ^:const, but that would inhibit the "plugin system"
;; from loading "plugin" namespaces at launch if they're on the classpath
(future (vec (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))))
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 (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 ^:const ^java.util.regex.Pattern uuid-regex
"A regular expression for matching canonical string representations of UUIDs."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment