Skip to main content

Quit Datasette if it has not recieved traffic for a specified time period

Project description


PyPI Changelog Tests License

Quit Datasette if it has not recieved traffic for a specified time period

Some hosting providers such as Fly offer a scale to zero mechanism, where servers can shut down and will be automatically started when new traffic arrives.

This plugin can be used to configure Datasette to quit X minutes (or seconds, or hours) after the last request it received.


Install this plugin in the same environment as Datasette.

datasette install datasette-scale-to-zero


This plugin will only take effect if it has been configured.

To configur, add the following to your metadata.json or metadata.yml configuration file:

    "plugins": {
        "datasette-scale-to-zero": {
            "duration": "10m"

This will cause Datasette to quit if it has not received traffic for 10 minutes.

You can set this value using a suffix of m for minutes, h for hours or s for seconds.


To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd datasette-scale-to-zero
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datasette-scale-to-zero-0.1.tar.gz (6.9 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page