verbb / formie

The most user-friendly forms plugin for Craft CMS.
Other
95 stars 72 forks source link

Shortest Data Retention possible #1954

Closed svondervoort closed 3 months ago

svondervoort commented 3 months ago

Question

What is the best setup to have the shortest Data Retention possible?

Currently we are using the afterSaveSubmission event to do some magic mapping and sending data to AFAS (CRM). There is no mail notifications being send (as of now) and we would like to keep the submission and files as short as possible.

We have Data Retention set to 10 minutes and a cronjob setup to prune every 10 minutes */10 * * * * ./craft formie/gc/prune-data-retention-submissions. But I am wondering if this can be even shorter since we use the afterSaveSubmission event since the magic logic uses the submissions data to map.

Additional context

No response

engram-design commented 3 months ago

I would say that if you can help it, to use a Daemon or similar rather than a cron job for speedy execution. With this approach you have a listener on your server continually listening to the queue and running jobs as soon as they are added.

But if your after submission code isn’t using the integration or email notifications stuff then there’s no reason you can put that retention down as low as you can.

You’ll also want to force garbage collection to run with ./craft gc

svondervoort commented 3 months ago

Do you advice using craft gc instead of the build in formie prune command?

engram-design commented 3 months ago

Sorry, my mistake. Using the ./craft formie/gc/prune-data-retention-submissions is the more direct way to action pruning. In fact, it's this command that is added to Craft's garbage collection service, which is only run at certain times. Running this command will ensure that submissions are pruned immediately.