Chuck-NORRIS
Worker Guide
Chuck Non-Operational Records & Related Images (NORRIS) is a scheduled worker built to delete (chuck) submission tracking records and Images that are no longer needed (non-operational).
Purpose
Delete tracking records of successful submissions, older than 1 day, from the database.
Delete tracking records of hanging (incomplete) submissions, older than 1 day, from the database and their corresponding images from Cloudflare Images.
Delete tracking records of unsuccessful submissions, older than 30 days, from the database.
Show up here and there in the docs to make you smile! π
Default Frequency
Once, Every day, at 3:30am UTC.
Can be changed through the wrangler.toml
file or the Cloudflare Dashboard.
Prerequisites
Since, UDP connections are not possible from Cloudflare workers, we need to communicate with our database through HTTP requests (TCP). Setting up an atlas app service (realm) instance, linked to our pendingsubmissions
collection would be required to make this happen.
This guide details this process:
Please ensure the following rule
configuration for the pendingsubmissions
collection:
Role
readAndWriteAll
Apply When
Always
Document Permissions
Read, Write, Search
Field Permissions
Read: All, Write: All
Chuck-NORRIS can delete the Recycling Bin!
Not really, but please be careful when setting up this rule. Make sure that 'Apply When' is set correctly and that the rule is applied to the correct collection to avoid inadvertent data loss.
Environment Variables
The following environment variables are required:
REALM_ID
Atlas App ID
Auth
REALM_KEY
Atlas App Service (Realm) API Key
Auth
REALM_DB
Name of the MongoDB database to be accessed.
Identification
CLOUDFLARE_TOKEN
API key to access Cloudflare Images
Auth
CLOUDFLARE_ID
Cloudflare Account ID
Auth
Related Resources
Last updated
Was this helpful?