f4c-scheduled-cleanup v0.1.0
subsystem
capsule://quake0day/[email protected]
A Cloudflare Scheduled Worker that periodically cleans up expired chat rooms from Cloudflare KV and deactivates corresponding RealtimeKit meetings to prevent resource leakage.
Owns
- Scheduled task execution logic
- Scanning and deleting expired room records from Cloudflare KV
- Deactivating RealtimeKit meetings associated with expired rooms
Does not own
- Real-time communication logic
- Bot logic
- Room creation or client-side authentication
AI orientation
This capsule is a scheduled cleanup worker. Agents should focus on optimizing KV queries, ensuring robust error handling for API calls, and verifying that expired rooms are consistently removed. The `ROOM_MAX_AGE_MS` is a critical parameter.
Avoid
- Introducing any real-time or interactive logic.
- Modifying the room expiry logic without coordinating with `f4c-room-api`.
Provides
event:scheduled_trigger— Responds to Cloudflare Worker scheduled events to perform cleanup.
Requires
env:ROOMS_KV— Cloudflare KV Namespace containing room metadata.env:CF_API_TOKEN— Cloudflare API token for RealtimeKit API calls.env:CF_ACCOUNT_ID— Cloudflare account ID for RealtimeKit API calls.env:RTK_APP_ID— RealtimeKit application ID for deactivating meetings.
Dependencies
Capsules
f4c-room-api>=0.1.0
Invariants (must always hold)
- Expired rooms must be removed from `ROOMS_KV`.
- Corresponding RealtimeKit meetings must be deactivated.
Source files (1)
Click any file to view its content; the path on the right shows where the file lands when this capsule is installed.
src/app/src/do/ScheduledHandler.ts→do/ScheduledHandler.ts
Plus capsule.yaml and
install.json.