Skip to main content
A long-running operation starts work that Sevalla finishes in the background: the request returns as soon as the work is queued, and you poll another operation to learn how it ended. Deployments, database changes, backups, restores, suspensions and most deletions work this way.

How it works

A long-running operation returns one of two things:
  • The new object, with a status. Trigger deployment returns the deployment with status waiting, and Create database returns the database with status creating. Poll the object’s GET operation until the status is final.
  • A message. Restore database backup returns 202 with {"message": "Database backup restore started"}, and Suspend application returns 200 with a message. Poll the service the operation acts on.
Poll every 10 seconds or more, and stop at a final status or after a timeout you choose. Polling counts toward the read rate limit of 400 requests per minute for the company. For deployments, a webhook on APP_DEPLOY or STATIC_SITE_DEPLOY tells you when they end, without polling.

Deployments

Application and static site deployments have the same statuses: An application deployment’s finished_at is set when it succeeds, fails or is cancelled. To stop a deployment, call Cancel deployment or Cancel static site deployment.

Wait for a deployment

Trigger the deployment, keep its id, then get it until the status is final:
The response has more fields, such as steps, repo_url and commit_sha: see Trigger deployment. In code:
wait-for-deployment.ts

Databases

Poll Get database and read status: Suspend database and Activate database don’t change status: is_suspended changes to true or false when they finish. For Delete database, see Deletions. Restarting, updating, suspending, restoring and deleting a database are rejected with 400 while the database is busy, for example while a backup is in progress. Wait for ready before you start the next operation.

Backups

Backups have no status of their own: poll the list until a backup with your display_name appears.

Deletions

While the deletion runs, status is deleting. Deleting a static site or a project finishes before the response.

Other background operations

Changes that wait for a deployment

Some operations finish at once but take effect only at the application’s next deployment: creating a process, changing a process’s resource type, scaling or probes, deleting a process, and changing environment variables. Trigger a deployment to apply them. With is_restart set to true, the deployment reuses the last successful build instead of building again.