summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/gallery_task.php
diff options
context:
space:
mode:
authorNathan Kinkade <nkinkade@nkinka.de>2010-12-06 16:14:26 +0000
committerNathan Kinkade <nkinkade@nkinka.de>2010-12-06 16:14:26 +0000
commitcf1965957c48b1c88a3913f8167688d03d191cec (patch)
tree9da9e719c68f4428771c9b70389b93f7a1bafd26 /modules/gallery/helpers/gallery_task.php
parent1659e487a26ef0460926376b7b8b40aaba0c0577 (diff)
parentc3ef8921260db8e39b6d2a7b4708e3d19f35f8b5 (diff)
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/gallery/helpers/gallery_task.php')
-rw-r--r--modules/gallery/helpers/gallery_task.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/gallery/helpers/gallery_task.php b/modules/gallery/helpers/gallery_task.php
index d56edabb..e69ff91a 100644
--- a/modules/gallery/helpers/gallery_task.php
+++ b/modules/gallery/helpers/gallery_task.php
@@ -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") {