Skip to content
StaticScope
Overview
Get StaticScope

Caches and background jobs

What each cache holds, when clearing it helps, and how queued jobs run, lock and fail.

Features Updated 21 November 2026 6 min read

StaticScope keeps what it has found, copied and prepared, so an update only redoes the parts that changed. It can also do that work in the background when content changes. The two screens are Caches and Background jobs, both administrator-only.

What each cache holds

CacheContentsClearing it
Pages foundURLs to fetch, found in WordPress and from the pages it copiesThe next detection rebuilds it
Copy cacheOne row per crawled URL with a content hash, HTTP status and any redirect targetThe next crawl copies every page again
Copied filesThe crawled site on diskAlso clears the copy cache, since neither is useful alone
Prepared filesThe processed site that gets publishedYou lose the build until you prepare it again
Upload recordPaths and hashes an add-on has uploaded, per namespaceThe next publish uploads every file again

The cache list screens are hidden from the menu and opened from Caches. Upload records are namespaced per destination, such as s3:bucket@endpoint or server:user@host:port:path, so changing the bucket, host, port or folder starts a fresh record instead of treating another destination’s files as yours.

How the caches are used

The copy cache is what Settings → Skip unchanged pages (useCrawlCaching) uses. The crawler hashes each response and skips writing it when the same URL produced the same hash last time. Saving a post removes that post’s row, so it is copied next time even if nothing else changed.

The prepared files are not a cache in the reuse sense. Post-processing starts from an empty directory and rebuilds the prepared site from the copied files every time, so a search index or add-on change cannot leave an old file behind. The deploy cache is where reuse matters: a publishing add-on checks each file’s hash and skips the upload when the destination already has it.

When to clear one

  • A page or file is stuck at an old version after an edit that did not go through save_post, such as an import or a direct database change: clear the copy cache and crawl again. A normal save removes that page’s row automatically.
  • A page was deleted in WordPress but is still in the build: clear the crawl queue and copy cache, then detect and crawl again.
  • You need a clean build before a release: Delete all caches removes the queue, copy cache, copied files, prepared files and every upload record.
  • A publish keeps skipping a file that you know changed: clear that add-on’s upload record only. Clearing every namespace makes all destinations upload everything.

Deleting all caches does not touch WordPress content, settings or the publishing add-on’s connection. It does mean the next build copies everything from scratch, which is slower but not otherwise different.

What a background job is

A job is one step of a build, queued in the database. The four types are Find pages (detect), Copy pages (crawl), Prepare files (post-process) and Publish (deploy). A job moves through Waiting, Running, Done, Didn’t finish or Skipped. The screen shows the most recent 100.

What starts a job

Saving a published post or page adds jobs when When a post is saved is on. Trashing one adds jobs when When a post is deleted is on. Both only add the steps enabled under What each job does, so you can have a queue that copies and prepares but never publishes. Add jobs on the Background jobs screen does the same on demand.

Duplicates are suppressed. Adding a job of a type that already has a waiting job does nothing, and a queue run marks older waiting duplicates of a type as Skipped so only the newest runs. Bulk edits and imports do not flood the queue as a result.

Cron and timing

Check for jobs schedules staticscope_process_queue every 1, 5 or 10 minutes; 0 turns the schedule off. The custom intervals are registered by the plugin, and deactivating it clears the event. WordPress only runs due cron events when a request arrives, so a quiet local site needs a real cron job or a page load.

Start straight away sends a non-blocking request to admin-post.php as soon as jobs are added. That request carries a nonce and the current cookies, and adds HTTP basic authentication headers when the site is protected. It is a loopback request, so a site that cannot reach itself will not start the queue this way; the cron event is still the fallback.

Locking

The queue is built to run one job at a time: it checks for any row marked Running and stops if it finds one. Each job also takes a MySQL named lock for its type, waiting up to 30 seconds, and releases it in a finally block. MySQL releases the lock if PHP dies, which is what makes a stuck row recoverable rather than permanent.

Before running anything, the queue marks a Running job as failed when its type’s lock is free: that row’s request is gone. Opening the Background jobs screen does the same cleanup, so a stuck row often changes to “Didn’t finish” when the screen is opened.

When a job fails

The job is marked failed with its duration, the message goes to the activity log, and staticscope_publish_failed fires. If an email address is set in Settings, that address gets the failure. Every waiting job is then marked Skipped, because later steps would otherwise run on a stale copy.

There is no retry count on the queue. A failed job stays failed; the next post save or Add jobs starts a new one. The GitHub add-on’s scheduled publishing has its own retries, every 10 minutes up to six attempts, but that is separate from this queue.

Diagnose a stuck job

  1. Open StaticScope → Background jobs. This alone clears rows whose lock is free, so refresh before assuming it is stuck.
  2. Read the Activity log. A failure names the step and the error; a start with no matching finish usually means the request was cut off.
  3. Run wp staticscope status jobs to see waiting and total counts by type.
  4. Run wp staticscope process_queue if jobs are waiting and nothing is moving. It performs the failure cleanup first, then runs what is left.
  5. If a publish reports that another publish is running, the add-on still holds its own lock. Wait, or check that no PHP request is still working; the lock goes when the connection does.
  6. Clear the queue with Clear jobs and history when the rows are wrong and you only want the state gone. That does not delete files or caches.

A job that keeps dying on the same step is usually a PHP time or memory limit rather than the queue. The add-on raises the execution limit where it can, but a host that kills long requests leaves a partial build. The activity log and the add-on’s own error message are more useful than the queue status at that point.

Next