Closed (fixed)
Project:
Webform
Version:
7.x-4.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Sep 2015 at 20:31 UTC
Updated:
24 Jan 2016 at 21:14 UTC
Jump to comment: Most recent
As reported in a comment in the related issue, webform loops through each submission to clear it. This is potentially a problem if there are a lot of submissions. The loop is needed because there are hooks to be called. Otherwise the submissions could be deleted directly from the database with SQL.
I'm not sure what to do about this. We could use the batch api, which is a pain. We could create a drush command, which avoids the time limit but may still run out of memory. We could just delete the first N (which would be a hidden config variable), where N might be set pretty big initially (maybe 1000), and report if there are still more.
Comments
Comment #2
peterx commentedHow big is big?
You could process N and put the rest in a queue. Either cron, or a Poormanscron style module, could visit the queue.
If you are shutting down a form, closing the form in the first process and removing submissions in cron is not a problem because there is no time limit.
The problem is different when you want to clear existing submissions while leaving the form open for new submissions. For that situation, you would need a flag you can set to "delete" then let cron perform the delete.
Comment #3
danchadwick commentedThis patch uses the batch API for clearing submissions. It uses a batch size of the export batch size or 500, whichever is lower. This lower limit compensates for the extra load to delete submission.
Committed to 7.x-4.x.
Comment #4
danchadwick commentedComment #7
fenstratCommitted and pushed to 8.x-4.x.