How file expiration and cleanup works
masterThe service manages file lifecycles using a combination of timers and manual deletions:
- Key Expiration: When a key is generated, a timer is set for
expireDelay(30 seconds). If no activity occurs, the key is removed from memory. If the session persists, the key can live up tomaxExpireDuration(1 hour). - File Cleanup: When a new file is uploaded to an existing key, the previous file associated with that key is deleted from the
uploads/directory. - Manual Deletion: Calling
DELETE /file/:keyimmediately clears the file association for that key. - Automatic Cleanup: If a conversion process (like
kindlegen) fails, the service attempts to delete the temporary input and output files.