bstarynk / helpcovid

a C++ free software web application (GPLv3+, Linux) to organize people helping other neighbours in Covid pandemics
GNU General Public License v3.0
2 stars 2 forks source link

cleanup code is incomplete #36

Open bstarynk opened 4 years ago

bstarynk commented 4 years ago

In commit 8ec372667c179fc65901456e67f6 we do have some

--cleanup

program option. That program flag is supposed to be run by ./helpcovid launched from some crontab(5) job running e.g. every five or ten minutes. It runs the hcv_background_periodic_cleanup C++ function in C++ file hcv_background.cc which should also be run periodically.

That hcv_background_periodic_cleanup C++ function is incomplete, and should cleanup both the database and any global data structure (protected by some std::mutex or std::recursive_mutex). We may need to use also some std::condition_variable and/or synchronize threads using hcv_bg_event_fd so eventfd(2).

We might also synchronize threads using pipe(7) or temporary fifo(7).