kobotoolbox / kobocat

Our (backend) server for providing blank forms to Collect and Enketo and for receiving and storing submissions.
BSD 2-Clause "Simplified" License
117 stars 127 forks source link

Improve `soft_delete_orphan_attachments` management command speed #902

Closed noliveleger closed 1 year ago

noliveleger commented 1 year ago

Description

Only process edited submissions

Notes

Each submission has two dates, date_created and date_modified. After some testing, it appeared that date_modified is the (almost) same (within a few milliseconds) than date_created when the submission is not edited. Assuming that its almost impossible to edit a submission within 10 seconds of the creation, the management command now skips submissions where its modification date is more or less 10 seconds of the creation.