Spaces:
Sleeping
Sleeping
Download src/utils/throttledCleanup.js from Huzaifa1435/Carpool: direct link, hf CLI and curl.
- Browser
- Download file 677 Bytes
-
https://huggingface.co/spaces/Huzaifa1435/Carpool/resolve/main/src/utils/throttledCleanup.js
- Command line
-
hf download hf://spaces/Huzaifa1435/Carpool/src/utils/throttledCleanup.js
-
curl -L -o throttledCleanup.js https://huggingface.co/spaces/Huzaifa1435/Carpool/resolve/main/src/utils/throttledCleanup.js
677 Bytes
| const { cleanupExpiredRides, cleanupExpiredCustomerRequests } = require('./lifecycleCleanup'); | |
| let lastRideCleanup = 0; | |
| let lastRequestCleanup = 0; | |
| const CLEANUP_INTERVAL_MS = 60 * 1000; | |
| async function maybeCleanupExpiredRides() { | |
| const now = Date.now(); | |
| if (now - lastRideCleanup < CLEANUP_INTERVAL_MS) return; | |
| lastRideCleanup = now; | |
| await cleanupExpiredRides(); | |
| } | |
| async function maybeCleanupExpiredCustomerRequests() { | |
| const now = Date.now(); | |
| if (now - lastRequestCleanup < CLEANUP_INTERVAL_MS) return; | |
| lastRequestCleanup = now; | |
| await cleanupExpiredCustomerRequests(); | |
| } | |
| module.exports = { maybeCleanupExpiredRides, maybeCleanupExpiredCustomerRequests }; | |