Skip to content

Commit

Permalink
Loosen N+1 query detection again (metabase#46081)
Browse files Browse the repository at this point in the history
I tightened this up by removing the condition here, thinking that CI
would catch it if it was necessary - but I'm getting failures in
development. Oops - didn't realize that this defmethod wasn't actually
applied during CI runs.
  • Loading branch information
johnswanson authored Jul 25, 2024
1 parent b17b351 commit f9e2720
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dev/src/dev.clj
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,10 @@
x))

(methodical/defmethod t2.hydrate/hydrate-with-strategy :around ::t2.hydrate/multimethod-simple
"Throws an error if do simple hydrations that make DB call on a sequence."
"Throws an error if simple hydrations make DB calls (which is an easy way to accidentally introduce an N+1 bug)."
[model strategy k instances]
(if config/is-prod?
(if (or config/is-prod?
(< (count instances) 2))
(next-method model strategy k instances)
(do
;; prevent things like dereferencing metabase.api.common/*current-user-permissions-set* from triggering the check
Expand Down

0 comments on commit f9e2720

Please sign in to comment.