2

I'm importing a large dataset into the database using the BatchBuilder in Drupal. It takes more than one and a half hours to complete all the operations in the batch. The process starts with user action on a page, and the progress of the batch operation is shown to the user. We are facing an error on the batch process if there's a connectivity issue on the user side. For example, if the user started the batch process in a tab and left the machine idle. After some time, the machine enters into suspended mode, and the internet connection won't be available. This will halt the batch process, and the entire progress made will be gone.

Screenshot of the batch process running. Running the batch process

Runs into an error if there's a connection issue on the user end. Runs into error on connectivity issues

Is there any way or workarounds to fix this? May be like changing the batch operation to the server side from the client side.

5
  • 2
    The connection to the client cannot be killed. They can prevent the machine from going into suspend mode. Otherwise create/run Drush commands to do this same work in the background from a scheduled job. Commented Feb 22, 2023 at 18:18
  • 1
    There are apps that prevent hibernation at the touch of a button, for example: apps.apple.com/us/app/amphetamine/id937984704?mt=12 Use one. Commented Feb 22, 2023 at 18:37
  • 2
    That's a job for the Queue API that will finish things on cron. User action will add items to queue. Cron will process. No session necessary. Commented Feb 22, 2023 at 18:58
  • Batch operations require the browser to stay connected to the server for the full duration of the operations. Once the browser disconnects from the server, batch operations are interrupted. The only way to avoid that is using Drush or using the queue API and cron tasks, but in the latter case, it will be necessary to run cron more times. Commented Mar 18, 2023 at 9:28
  • (Essentially, with batch operations, it is the browser that causes the operations to progress, by requesting a page at pre-set intervals and with a different parameter value.) Commented Mar 18, 2023 at 9:34

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.