#BackgroundTasks
En FastAPI podemos definir tareas en segundo plano de manera sencilla con BackgroundTasks y que NO bloquean el hilo principal
October 25, 2026 at 4:10 PM
Đăng lại một bài cũ nhưng vẫn còn nguyên giá trị cho ai đang làm API với FastAPI: 'FastAPI: xử lý việc nặng ở background với BackgroundTasks, client không phải chờ'. Ai chưa đọc thì đọc thử nhé!
FastAPI: xử lý việc nặng ở background với BackgroundTasks, client không phải chờ
Khi một API phải làm việc chậm như gửi email, xử lý file hay gọi dịch vụ bên ngoài, đừng bắt client đứng chờ. Trong FastAPI, bạn chỉ cần khai báo thêm tham số background_tasks: BackgroundTasks trong endpoint và gọi background_tasks.add_task(...) — response được trả về ngay lập tức, còn việc nặng sẽ chạy ở background ngay sau đó. Kỹ thuật này áp dụng cho mọi tác vụ "chậm nhưng không cần kết quả ngay": gửi email, push notification, ghi log, xử lý file upload.
linhfish.dev
October 20, 2026 at 1:20 PM
Work that survives a client disconnect is the sleeper topic here. Most first agent endpoints die the moment someone closes the tab mid-stream, and BackgroundTasks won't outlive a worker restart.
September 29, 2026 at 7:51 PM
FYI: Google lets Gemini agents run background tasks without breaking connections #Google #Gemini #BackgroundTasks #TechUpdate #CloudComputing
Google lets Gemini agents run background tasks without breaking connections
Background execution ends fragile open connections for long tasks. Remote MCP links, custom function calls and credential refresh round out today's update.
ppc.land
July 15, 2026 at 7:14 PM
ICYMI: Google lets Gemini agents run background tasks without breaking connections #Google #Gemini #BackgroundTasks #OpenConnections #RemoteMCP
Google lets Gemini agents run background tasks without breaking connections
Background execution ends fragile open connections for long tasks. Remote MCP links, custom function calls and credential refresh round out today's update.
ppc.land
July 13, 2026 at 7:13 PM
Google lets Gemini agents run background tasks without breaking connections #Google #Gemini #BackgroundTasks #TechUpdate #RemoteMCP
Google lets Gemini agents run background tasks without breaking connections
Background execution ends fragile open connections for long tasks. Remote MCP links, custom function calls and credential refresh round out today's update.
ppc.land
July 12, 2026 at 7:12 PM
FYI: Google lets Gemini agents run background tasks without breaking connections #Google #Gemini #BackgroundTasks #TechUpdate #CloudComputing
Google lets Gemini agents run background tasks without breaking connections
Background execution ends fragile open connections for long tasks. Remote MCP links, custom function calls and credential refresh round out today's update.
ppc.land
July 15, 2026 at 7:14 PM
ICYMI: Google lets Gemini agents run background tasks without breaking connections #Google #Gemini #BackgroundTasks #OpenConnections #RemoteMCP
Google lets Gemini agents run background tasks without breaking connections
Background execution ends fragile open connections for long tasks. Remote MCP links, custom function calls and credential refresh round out today's update.
ppc.land
July 13, 2026 at 7:13 PM
Google lets Gemini agents run background tasks without breaking connections #Google #Gemini #BackgroundTasks #TechUpdate #RemoteMCP
Google lets Gemini agents run background tasks without breaking connections
Background execution ends fragile open connections for long tasks. Remote MCP links, custom function calls and credential refresh round out today's update.
ppc.land
July 12, 2026 at 7:12 PM
Also, I decided to schedule only one reminder (of the given kind) into the future for each habit and scheduled background task that should schedule the next ones if needed every 30 minutes. I don’t know what the best practice is here, tbh.
#TaskScheduling #BackgroundTasks
May 1, 2025 at 7:15 PM
The problem with that is when the user doesn’t open the app for a day, I don’t have a way for scheduling the next reminder. I could use a background task for that, but there is no guarantee it’ll be run - thanks 🍎.
#BackgroundTasks #AppleDev #DevStruggles
April 28, 2025 at 5:41 PM
Windows App SDK 1.7 branch shows signs of CameraCaptureUI, OAuth authentication and BackgroundTasks oauth and backgroundtask in 1.7: github.com/microsoft/Wi... #dotnetconf
Merged PR 11759027: Snap 1.7-experimental1: main to release/1.7-stable · microsoft/WindowsAppSDK@65d3f87
A microsoft employee must use /azp run to validate using the pipelines below. WARNING: Comments made by azure-pipelines bot maybe inaccurate. Please see pipeline link to verify that the build is b...
github.com
November 13, 2024 at 12:52 AM
I missed this new framework announcement during WWDC! BackgroundTasks.framework seems pretty neat. https://developer.apple.com/documentation/backgroundtasks

Time to go watch Session 707 now 🤓 https://developer.apple.com/videos/play/wwdc2019/707
Background Tasks | Apple Developer Documentation
Request the system to launch your app in the background to run tasks.
developer.apple.com
November 18, 2024 at 11:54 PM
🔄 𝑆𝑐ℎ𝑒𝑑𝑢𝑙𝑖𝑛𝑔 𝑎𝑛𝑑 ℎ𝑎𝑛𝑑𝑙𝑖𝑛𝑔 𝑏𝑎𝑐𝑘𝑔𝑟𝑜𝑢𝑛𝑑 𝑎𝑝𝑝 𝑟𝑒𝑓𝑟𝑒𝑠ℎ 𝑖𝑛 𝑆𝑤𝑖𝑓𝑡𝑈𝐼 by Natalia Panferova (@natpanferova.bsky.social)

From 𝐵𝐺𝐴𝑝𝑝𝑅𝑒𝑓𝑟𝑒𝑠ℎ𝑇𝑎𝑠𝑘𝑅𝑒𝑞𝑢𝑒𝑠𝑡 to the .𝑏𝑎𝑐𝑘𝑔𝑟𝑜𝑢𝑛𝑑𝑇𝑎𝑠𝑘 modifier - keep your app's data fresh behind the scenes.

#SwiftUI #BackgroundTasks #iOSDev

nilcoalescing.com/blog/Schedul...
Scheduling and handling background app refresh in SwiftUI
Configure a SwiftUI app to schedule and handle a background fetch task using the Background Tasks framework and the backgroundTask(_:action:) SwiftUI modifier.
nilcoalescing.com
May 12, 2026 at 3:03 PM
🔇 𝐷𝑜 𝑗𝑜𝑏 𝑠𝑖𝑙𝑒𝑛𝑡𝑙𝑦 by Kyryl Horbushko

Want fresh data without making users wait? A complete guide to iOS background tasks and the common pitfalls you'll encounter when implementing them.

#iOSDev #BackgroundTasks #iOS

khorbushko.github.io/article/2025...
Do job silently
We depend more and more on data and on its computation. Think for a moment about how often we use computation and data processing. This aspect can’t be not reflected in the modern apps, especially…
khorbushko.github.io
October 22, 2025 at 7:00 AM
O mais simples que consigo imaginar é rodar em uma task independente no mesmo processo que está servindo o seu backend.

No FastAPI tem as BackgroundTasks pra isso, no Node vc pode só lançar uma Promise e cuidar pro processo não encerrar enquanto tiver alguma pendente (tem técnicas pra isso).
June 24, 2025 at 12:14 AM
Any chance you can periodically refresh the tokens in the background using BackgroundTasks?
May 10, 2025 at 1:29 AM
new on medium:

The Trick Was Me Thinking I Wasn’t Being Tricked

a personal essay about overworking, self-deception, and the myth of “just one more task”

if you’ve ever mistaken exhaustion for progress—this is for you

medium.com/@fladry.crea...

#writing #burnout #backgroundtasks
June 6, 2025 at 11:11 PM
The BackgroundTasks framework doesn't support macOS. There's `NSBackgroundActivityScheduler`, but the API is totally different.

Am I the only person that would have interest a source-compatible cross-platform implementation?

github.com/chimeHQ/Back...
GitHub - ChimeHQ/Background: Background Tasks and Networking
Background Tasks and Networking. Contribute to ChimeHQ/Background development by creating an account on GitHub.
github.com
March 15, 2025 at 12:53 PM
このページ、解決する前に見つけてたんだけど、SQLAlchemyだから関係ないや、と思って全部読んでなかった。今日読み返してみると、どんぴしゃり。問題点はSQLAlchemyと関係ないところだった。
zenn.dev/killinsun/ar...
なるほど、BackgroundTasksに行く前にfinallyまで行っちゃうから、裏でプールがないっていうんだ。考えてみればそりゃそうだよなぁ。時間がかかるから裏で動かしてるのであって、その前にPOSTが終わるようにしているんだもの。確かに、プールを閉じるんじゃなくてconnを返すだけだとちゃんと動くんだ。つまり、やっぱりclassは表裏共通。
[FastAPI][SQLAlchemy] BackgroundTasks を使う際は Depends せず新規コネクションにしときなさい
zenn.dev
February 28, 2025 at 1:38 PM
New micro-app write-up: Daily Quote Fetcher.

A small iOS app used to explore background tasks, notification timing, and what happens when you stop fighting the system and design with it instead.

iamshift.substack.com/daily-quote-...

#iamshift
#iOS #SwiftUI #Swift #BackgroundTasks
Daily Quote Fetcher
Calm Consistency Through Background Design in iOS 26
iamshift.substack.com
January 7, 2026 at 2:15 PM
Learn how to implement background tasks in ASP.NET Core using hosted services! Enhance your app's performance and efficiency by decoupling long-running processes. #ASPNETCore #BackgroundTasks
Implementing Background Tasks in ASP.NET Core using Hosted Services
In ASP.NET Core, background tasks are long-running processes that run independently of user interactions. Whether you’re sending emails…
malshikay.medium.com
August 2, 2025 at 12:15 AM
Cloud Run throttles CPU post-response—your BackgroundTasks freeze until next request. Silent data loss risk. Move critical work before response or enable always-on CPU.
The Background Task That Froze: A Serverless CPU-Throttling Mystery
Four Signals — The Wire
www.foursignals.dev
July 11, 2026 at 7:00 PM
#FastAPI is absolutely wild.

Needed a task scheduler...
BackgroundTasks

Needed to access the db at a different layer...
Dependency Injection

Needed a front end for testing...
Swagger and Redoc were both built in

What a cool world.
Sincerely, a relatively green Python developer.
November 13, 2024 at 2:38 PM