deliciousbrains / wp-queue

Job queues for WordPress
MIT License
170 stars 38 forks source link

Queue stuck when PHP memory_limit set as 2G #10

Closed ianmjones closed 4 years ago

ianmjones commented 4 years ago

When the PHP memory_limit is specified with a "G" suffix rather than "M" suffix, the queue never runs.

This is down to the \WP_Queue\Cron::get_memory_limit function expecting the string to be in megabytes, effectively lopping off the suffix if present and then multiplying up by 1024 * 1024.

So instead of 2G being returned as 2,147,483,648 bytes, it is returned as just 2,097,152 (2Mb), which generally means "used memory" has exceed the returned value and so queue processing isn't even started.

Props to @polevaultweb for finding and fixing this in the plugin that this library was extracted from.