# Time limits

Every route has a deadline: 10 seconds, unless `deadline:` sets another,
and never more than 60. A request that hangs holds a database connection,
so no route may run for long.

```jadpo
POST /import {
    input: ImportTodos
    output: ImportResult
    deadline: 30s
    run: import_todos(input)
}
```

When the deadline passes, the runtime starts no new work, commits nothing
and answers 504 `deadline_exceeded`.

That holds for work that never waits too, such as a long calculation. The
runtime checks the deadline as the work runs, and a body that finishes past
it commits nothing. Compiled code checks it as the interpreter does: every
4,096 calls, loop turns and inline-function calls, in a function's loops
and inside an operation's inline function as in an action's. Each time an
action's loop checks, it gives the thread back to the other requests
beside it.

The deadline also covers calls to outside services, which have their own
shorter timeouts. Each call's `timeout:` times its attempts, summed along
the longest way through the route's action, must fit within the deadline,
or it is `route.calls_past_deadline`
([Calling](calling.md)).

Longer work answers `status: SuccessStatus.accepted` and carries on in a
subscriber, code that runs when an event is delivered
([Subscribers](subscribers.md)). Or the route waits for
it with `settle:` ([Waiting for follow-on work](waiting-for-follow-on-work.md)).
