# Sleeping environments

> Preview environments stop after 30 minutes without use and start on the first visit. Staging does too, out of sight. Live never sleeps.

Source: https://docs.wpwaterfall.com/sleeping-environments

Staging and preview environments stop by themselves when nobody uses them, and start again when someone does. **Live never sleeps.** Staging does this out of sight: it never says it is sleeping, and opening your site, visiting it, or connecting with Git, SFTP, or SSH wakes it. A sleeping environment keeps its code, database, and uploads. It only stops using the server's memory.

## When one goes to sleep

An environment goes to sleep after **30 minutes** with none of these:

- a visit to its address or its temporary address;
- an open SSH or SFTP connection;
- a job that works on it, such as a backup, a push, a clone, or a WP-CLI command;
- a WordPress process that is still running, such as a long import.

Requests for `robots.txt` and the site icon do not count. Neither do WordPress cron calls and `xmlrpc.php`, so a crawler or a ping does not keep it awake. An open wp-admin tab does, because wp-admin checks in with the server while it is open.

A preview shows a grey **Sleeping** label. This is not an error. Staging shows no label. The Activity page says "Environment went to sleep after 30 minutes without requests."

## What wakes it

A connection with Git, SFTP, or SSH starts a sleeping environment, and your client waits a few seconds and then works. Opening a site in the dashboard starts its staging. The first visit to the address of a sleeping environment starts it too. The visitor waits a few seconds on that first request, then sees the page. If it takes longer than about 20 seconds, the visitor sees **Waking up** and the page reloads every 5 seconds.

You can also wake it yourself:

- Open a sleeping preview. On the **Info** tab, a card says it is sleeping. Choose **Wake up**.
- Send `POST /v1/environments/{id}/wake`, or ask your AI assistant to run `wake_environment`.
- Start any job on it. Backups, pushes, clones, and WP-CLI commands wake it first, then run.

Looking at a sleeping preview in the dashboard does not wake it. Its files and database tabs say the environment is asleep. Choose **Wake up** on the **Info** tab.

## Limits

- Password protection and IP rules still apply. A visit that WP Waterfall would refuse never wakes the environment.
- A bot cannot keep waking an environment: one environment wakes at most 6 times an hour from visits and connections, and one address at most 3 times an hour for one environment.
- A connection you keep open keeps the environment awake.
- If the server is very busy, a wake answers "This server is busy, try again", and the page retries. WP Waterfall never loses the environment.

## What a sleeping environment cannot do

- **Cron.** WordPress cron does not run while it sleeps. It catches up on the first visit after it wakes.
- **Backups.** A scheduled backup skips a sleeping environment when nothing changed since its last backup. If something changed, the backup wakes it once, takes the backup, and lets it sleep again.
- **Promote.** A promote needs staging running. Opening your site starts it, so if the promote preview says "Staging is starting", try again in a few seconds.

## Turn sleep off

The setting is **Sleep when idle**. The idle time is 30 minutes for every environment. It is on for every staging and preview environment, included or [additional](https://docs.wpwaterfall.com/additional-preview-environments), because they share the server. Only WP Waterfall staff can turn it off. Live has no setting, because it never sleeps.

## Quick answers

**Is my live site ever affected?**
No. Live is always on.

**Does the first visit to staging always take a few seconds?**
Only when it was asleep. Once it is awake, it answers as fast as any other environment.

**Will my client see an error page?**
Not on a normal wake. If the wake takes longer than 20 seconds, they see a plain **Waking up** page that reloads every 5 seconds.

## When the server is busy

Staging and preview environments share a small part of each server, so a busy hour of tests can never slow a live site. Each one runs on a small, capped profile (see [Site resources](https://docs.wpwaterfall.com/site-resources)), unless you upgrade that environment's [site tier](https://docs.wpwaterfall.com/site-tiers). When many environments wake at once, WP Waterfall starts two at a time and lines up the rest in the order they asked. If the server is under heavy load, a wake waits and tries again. You see **Waking up**, then your site. A wake from the dashboard or a job tries again by itself, so you do not need to press the button twice. Live sites are never put in this line.

## Related

- [Staging, live, and preview environments](https://docs.wpwaterfall.com/environments)
- [Additional Preview Environments](https://docs.wpwaterfall.com/additional-preview-environments)
- [Staging privacy](https://docs.wpwaterfall.com/staging-privacy)
- [Suspend and resume an environment](https://docs.wpwaterfall.com/suspend-an-environment)
