Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
1e16miin committed Sep 5, 2024
1 parent b592837 commit 40748ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
9 changes: 3 additions & 6 deletions src/com/walmartlabs/lacinia.clj
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,9 @@
(seq validation-errors)
(resolve/resolve-as {:errors validation-errors})

:else (let [context (assoc context constants/parsed-query-key prepared
::tracing/validation {:start-offset start-offset
:duration (tracing/duration start-nanos)})
context' (cond-> context
(::query-analyzer/enable? context) (assoc ::query-analyzer/complexity (query-analyzer/complexity-analysis prepared)))]
(executor/execute-query context'))))
:else (executor/execute-query (assoc context constants/parsed-query-key prepared
::tracing/validation {:start-offset start-offset
:duration (tracing/duration start-nanos)}))))

(defn execute-parsed-query
"Prepares a query, by applying query variables to it, resulting in a prepared
Expand Down
7 changes: 3 additions & 4 deletions src/com/walmartlabs/lacinia/executor.clj
Original file line number Diff line number Diff line change
Expand Up @@ -380,14 +380,13 @@
(let [parsed-query (get context constants/parsed-query-key)
{:keys [selections operation-type ::tracing/timing-start]} parsed-query
schema (get parsed-query constants/schema-key)
^Executor executor (::schema/executor schema)
analysis (::query-analyzer/complexity context)]
^Executor executor (::schema/executor schema)]
(binding [resolve/*callback-executor* executor]
(let [enabled-selections (remove :disabled? selections)
*errors (atom [])
*warnings (atom [])
*extensions (if analysis
(atom {:analysis analysis})
*extensions (if (::query-analyzer/enable? context)
(atom {:analysis (query-analyzer/complexity-analysis parsed-query)})
(atom {}))
*resolver-tracing (when (::tracing/enabled? context)
(atom []))
Expand Down

0 comments on commit 40748ac

Please sign in to comment.