Skip to content
App
Markdown

Background jobs

Queue-shaped apps — the platform pulls work from the organization's job queue and delivers it to your route.

Some apps have no visitors at all: connectors that sync a vendor's API, scheduled processors, notification fan-outs. On Pilvia App these are the same kind of app as everything else — same runtime, same manifest, same bindings — that opts into the organization's job queue:

{
  "name": "vendor-sync",
  "jobs": { "path": "/sync" }
}

With a jobs block, the host claims work queued for this app and delivers it as ordinary requests to the declared route, running as the app's own principal. Without one — the default — the host never runs the app except on a real request.

Pull, never push

The queue does not call into your app from outside. The platform pulls: it claims a job under a lease, POSTs it to your route, and your handler processes a slice of work and says whether more remains. The host loops — slice by slice, with a cursor — until the job reports done or the slice ceiling is hit. Long imports become many short requests, which is exactly what an instance-per-request runtime wants, and a crash mid-job means redelivery after the lease expires rather than lost work.

{
  "jobs": {
    "path": "/sync",
    "lease_secs": 900,
    "max_slices": 100,
    "poll_secs": 30
  }
}

Every knob is bounded by the host — a manifest declares intent, it does not set unbounded budgets. The lease must cover a whole run: there is no renewal, so a sweep that outlives its lease gets redelivered.

No inbound surface required

A pure connector declares no public routes and serves no hostname — nothing to firewall, nothing to scan. If outside systems also need to poke it (a webhook, a manual trigger), combine jobs with auth: token: scheduled work arrives through the queue with no token involved, and the token path stays for genuine outside callers.

Observability

Each slice leaves an access record like any request, and a whole run shares one trace id — "what did last night's sync do" is a query, not archaeology. See Request IDs and headers.

Type to search. ↑↓ to move, Enter to open, Esc to close.