########################################################################################## LOC-6: Periodic message clearance ########################################################################################## Issue Type: New Feature ----------------------------------------------------------------------------------------- Issue Information ==================== Priority: Major Status: Closed Resolution: Done (2018-05-19 12:39:15) Project: LocalChat (LOC) Reported By: btasker Assigned To: btasker Components: - Server Targeted for fix in version: - V0.0.2 Time Estimate: 0 minutes Time Logged: 0 minutes ----------------------------------------------------------------------------------------- Issue Description ================== One of the core principles of the design is that the server should only store the message payloads for a short time. So need to have a thread (or something) running to periodically flush out older messages (I originally said 15 minutes, but 5 sounds better). ----------------------------------------------------------------------------------------- Activity ========== ----------------------------------------------------------------------------------------- 2018-05-12 16:21:40 btasker ----------------------------------------------------------------------------------------- This needs doing, but also need to work out the best way to go about it. The easiest (tm) way of doing it would be to add a new Flask routed path (say /flush) which would trigger the flush. Then just add a cronjob. But it means an extra step in the deployment. I'm wondering if it might be better to spin up an additional thread which could periodically place the request (just as a cronjob would) to avoid the install procedure involving editing cronttab's (as if they're forgotten, or, deleted it could lead to leakage/compromise). ----------------------------------------------------------------------------------------- 2018-05-14 08:54:52 btasker ----------------------------------------------------------------------------------------- So the way I'm leaning on this, is it's probably best to spin up a thread and create an API endpoint. So that thread would periodically (via urllib2) place a request to the API to trigger the purge. As this is potentially an expensive operation we should protect it with a passphrase to stop arbitrary users from triggering it and blocking the API. At startup, the server app should generate a passphrase, which can then be passed into both the API request handler and the 'cron' thread. ----------------------------------------------------------------------------------------- 2018-05-19 12:06:37 git ----------------------------------------------------------------------------------------- -- BEGIN QUOTE -- Repo: LocalChat Host:Rimmer commit 74c2eb491a5bede03dd926d20afd73ffe105a3b7 Author: B Tasker