Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What is the code doing? Most of the time it's waiting for a socket. If it's not doing that, do the equivalent for whatever it is waiting for. If it's CPU-bound, add interrupt checks.


Places I've wanted to implement this in the past include:

- Run a subprocess such as "rg" and terminate early if necessary

- Run a SQLite SQL a query that errors if it takes more than a second

- Same but for other DBs - MySQL, PostgreSQL, Elastic, Mongo etc

- Execute a fragment of JavaScript in something like QuickJS with a time limit

- Brute force some kind of algorithm with a time limit - using a library I did not write myself




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: