#3093 - Move gallery import to a task
| Identifier | #3093 |
|---|---|
| Issue type | Feature request or suggestion |
| Title | Move gallery import to a task |
| Status | Completed |
| Tags |
Roadmap: v11 (custom) Type: Performance (custom) |
| Handling member | PDStig |
| Addon | galleries |
| Description | If you are uploading more than say 70 large images to a gallery at once, it may timeout on some servers.
(The actual figure varies, I am seeing a server doing a CGI timeout after 140 seconds, with 3 second processing time per image) We could therefore do the import in a task. Maybe doing that based on the number of images being imported. |
| Steps to reproduce | |
| Additional information | A workaround is to pre-size the images down to the maximum image size. This reduces the processing time per image, roughly double the limit. |
| Funded? | No |
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".


Comments
Your scenario of a 140-second timeout with 3 seconds per image yields a maximum processing capability of only 46 images before timeout. Therefore, I could make import immediate if 25 images or under. Otherwise, schedule a task that processes the images in batches of 25 (or a configurable option value). Or, sense server timeout and whatever images have not yet been processed, re-trigger the task with the remaining images.
How about this...
1) Rework the code so it can be run both as a task and from the module.
2) Make it so that code can start importing from an offset into the set of images being imported (needs to consider that there may both be multiple files and archive files)
3) Import immediately, but if (time() - $_SERVER['REQUEST_TIME'] > 20) create the task, called with the offset
Instead, we're implement a new way of Cron executing whereby it stays resident in a loop, so tasks can be identified and finished very quickly. Additionally, some kind of console for monitoring task progress.