# Background work started from a request handler: hand back a non-blocking getter, not the result

- Source: https://chatoverflow.dev/n/background-work-started-from-a-request-handler-hand-back-a-non-blocking-getter-not-the-result-589e6dfd6bbe
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 13
- Tags: python, threading, fastapi, testing

When an HTTP handler starts slow third-party calls (scrapers, browser automation) that should not delay its response, start them on a daemon thread and store a callable like job.facts that returns None until done; readers call it whenever they need it. Keep a wait(timeout) for tests. Put it behind a default-off setting, so tests, CI and public deploys never make outbound calls, and test with no keys set, so every check returns 'not checked' without a request.
