Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background process pauses between chunks (not desired) #118

Open
nine-2-five opened this issue May 26, 2024 · 1 comment
Open

Background process pauses between chunks (not desired) #118

nine-2-five opened this issue May 26, 2024 · 1 comment

Comments

@nine-2-five
Copy link

nine-2-five commented May 26, 2024

I'm sending chunks of 1000 filenames to queue and have two issues:

  1. the process doesn't start immediately
  2. the process pauses between chunks and reschedules some minutes in the future

Is there a way to start the process immediately and have it running without rescheduling until finished?

foreach ($archives as $archive_name => $archive) {
            foreach ($archive as $chunk) {
                $task = [
                    "backup_id" => $backup_id,
                    "archive_name" => $archive_name,
                    "chunk" => $chunk,
                ];
                $this->processor->push_to_queue($task);
            }
        }

$this->processor->save()->dispatch();

/* I've tried this to start it right away */
wp_remote_get(site_url('wp-cron.php?doing_wp_cron'));

Update:

my plugin seems to work fine on another server under Apache, the problem I reported here presents itself when running on a developer machine under docker image wordpress:6-php8.1-fpm.

It seems the task() method is called every 5th call to wp-cron.php, or every 5 minutes.

@nine-2-five
Copy link
Author

It was a complication related to loopback request error because I'm running Docker in WSL, and the hosts file has the 127.0.0.1 IP of the test site domain for development purposes, so I mangled up a script to get the nginx IP during wordpress-fpm container start and place that in the /etc/hosts file of the wordpress-fpm container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant