codeant-ai-for-open-source[bot] commented on code in PR #45478:
URL: https://github.com/apache/superset/pull/45478#discussion_r4462303992
##########
superset/coordination/base.py:
##########
@@ -525,6 +533,19 @@ def wake() -> None:
return SignalListener(thread, stop_event, wake=wake)
+ @staticmethod
+ def _capture_background_context() -> Callable[[], ContextManager[Any]]:
+ """Snapshot caller-thread context for a background thread to re-enter.
+
+ Resolves ``BACKGROUND_THREAD_CONTEXT_FACTORY`` on the calling thread
(where
+ the request/task context is live) and returns the callable the
background
+ thread uses to enter an equivalent context. Without a configured
factory
+ the returned context manager is a no-op, leaving the thread to push a
bare
+ app context per call as before.
+ """
+ factory = current_app.config.get("BACKGROUND_THREAD_CONTEXT_FACTORY")
Review Comment:
✅ **CodeAnt verified this suggestion was addressed in subsequent commits and
marked this thread resolved** as of `1af67b9`.
`_capture_background_context` now returns `contextlib.nullcontext` before
accessing `current_app` when no Flask app context exists.
<sub>If that's not right, unresolve this thread and CodeAnt will leave it
open.</sub>
<!-- codeant-auto-resolve-reply -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]