Skip to content

Commit

Permalink
warning to analyze result
Browse files Browse the repository at this point in the history
  • Loading branch information
1e16miin committed Aug 30, 2024
1 parent 32a7511 commit 3fa3943
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/com/walmartlabs/lacinia.clj
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@
(seq validation-errors)
(resolve/resolve-as {:errors validation-errors})

:else (let [complexity-warning (when (:max-complexity options)
(complexity-analysis/complexity-analysis prepared options))]
:else (let [analysis (when (:analyze-query options)
(complexity-analysis/complexity-analysis prepared))]
(executor/execute-query (assoc context constants/parsed-query-key prepared
:complexity-warning complexity-warning
:analysis analysis
::tracing/validation {:start-offset start-offset
:duration (tracing/duration start-nanos)}))))))

Expand Down
10 changes: 5 additions & 5 deletions src/com/walmartlabs/lacinia/executor.clj
Original file line number Diff line number Diff line change
Expand Up @@ -380,14 +380,14 @@
{:keys [selections operation-type ::tracing/timing-start]} parsed-query
schema (get parsed-query constants/schema-key)
^Executor executor (::schema/executor schema)
complexity-warning (:complexity-warning context)]
analysis (:analysis context)]
(binding [resolve/*callback-executor* executor]
(let [enabled-selections (remove :disabled? selections)
*errors (atom [])
*warnings (if complexity-warning
(atom [complexity-warning])
(atom []))
*extensions (atom {})
*warnings (atom [])
*extensions (if analysis
(atom {:analysis analysis})
(atom {}))
*resolver-tracing (when (::tracing/enabled? context)
(atom []))
context' (assoc context constants/schema-key schema)
Expand Down

0 comments on commit 3fa3943

Please sign in to comment.