Sqlite connexion is not properly reopened after executing the cron cleanfiles script
After executing the cron job for deleting the expired files, the sqlite database is not updated anymore if we upload new files.
When you upload a new file, the sqlite database
lufi.db is updated, in a sqlite WAL file named
lufi.db-wal. If you stop the lufi service, you will notice that the -wal file will disappear and the sqlite database
lufi.db is updated. Starting again the lufi service will create a new empty -wal file.
But, if you execute the cron script while the lufi service is running:
cd /var/www/lufi && sudo -u lufi carton exec script/lufi cron cleanfiles --mode production
the -wal file disappear, the sqlite database file is properly updated, but no new -wal file is created. Then, if you upload a new file, it succeeds, and the file is successfully available through the download link. But the file does not exist in the sqlite database
lufi.db (and there is no -wal file). If you stop the lufi service, the
lufi.db does not change. If you start again the lufi service, a new empty -wal file is created. The previously uploaded file (which is not stored in the sqlite database) is no more available though the download link, and the following error is displayed:
Error: the file has not been sent entirely.
It's like the cron script closed the sqlite connexion of lufi instance, but lufi does not reopen the sqlite connexion. Then, new uploaded files are still properly uploaded and available in the program memory, but they are not stored in the database. Therefore, if you restart the lufi service, you loose those files.
debian 9, libsqlite3-0, systemd, lufi 0.5.2
Restart the lufi service after executing the cron script.