Feat: Add Bounded Concurrency and Timeout Controls for /thumbnail #5
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Today, each
/thumbnailrequest can start ffmpeg work immediately. This is fine for light traffic, but during spikes (or when upstream media is slow/unreachable), the service can get overloaded and response times become unpredictable.Proposal
Add a small in-process job controller with configurable limits:
MAX_CONCURRENT_JOBS(default:4)MAX_QUEUE_SIZE(default:100)REQUEST_TIMEOUT_MS(default:15000)FFMPEG_TIMEOUT_MS(default:12000)Expected behavior:
MAX_QUEUE_SIZE.429(or503) and a clear JSON message.Example Error Responses
Acceptance Criteria
Why This Helps
This keeps the current API simple while making the service much safer and more predictable in real production traffic.
YAGNI, I don't think we need to invest any more effort into this project right now. We'll hyperscale when it starts causing problems. We can leave this open though because it's not a bad idea in theory.
Hey @hodlbod,
I’m a bit confused about which project I should focus on for Summer of Bitcoin.
Could you please suggest which one would be best to work on right now?
The options I’m considering are: flotilla, vthumbs, zoid, nostrlib, caravel, or any other project you think is more suitable.
Also, on the Summer of Bitcoin website, I only see flotilla listed as a project.
So, could you please confirm, should I focus only on flotilla for the application?
I want to focus properly on just one project, so your guidance would really help me decide.
Thanks!
Your proposal should focus on flotilla, that's where most of the long term work will be done. vthumbs is a separate repository, but it's really part of the main flotilla project as supporting infrastructure.