mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-08-22 23:05:18 -04:00
Shuffle up the way we figure out which image to rebuild next so that
multiple concurrent tasks actually work in parallel and don't stomp on each other. Fixes #1498.
This commit is contained in:
@@ -71,7 +71,12 @@ class gallery_task_Core {
|
||||
static function rebuild_dirty_images($task) {
|
||||
$errors = array();
|
||||
try {
|
||||
$result = graphics::find_dirty_images_query()->select("id")->execute();
|
||||
// Choose the dirty images in a random order so that if we run this task multiple times
|
||||
// concurrently each task is rebuilding different images simultaneously.
|
||||
$result = graphics::find_dirty_images_query()->select("id")
|
||||
->select(new Database_Expression("RAND() as r"))
|
||||
->order_by("r", "ASC")
|
||||
->execute();
|
||||
$total_count = $task->get("total_count", $result->count());
|
||||
$mode = $task->get("mode", "init");
|
||||
if ($mode == "init") {
|
||||
|
||||
Reference in New Issue
Block a user