summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/module.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-09-06 12:41:27 -0700
committerBharat Mediratta <bharat@menalto.com>2010-09-06 12:41:27 -0700
commitb3b6021b0a70979a1084111ae43c1170a7592b37 (patch)
treefd4c94f6da659232b3f7029a3bdfe0207555fd06 /modules/gallery/helpers/module.php
parent4a941829716df412b493d35907e65acc35527583 (diff)
Don't bomb on the race condition when we're trying to create the
gallery/_cache row and it already exists. Fixes ticket #1338.
Diffstat (limited to 'modules/gallery/helpers/module.php')
-rw-r--r--modules/gallery/helpers/module.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php
index ca6651f1..736b6854 100644
--- a/modules/gallery/helpers/module.php
+++ b/modules/gallery/helpers/module.php
@@ -448,7 +448,17 @@ class module_Core {
$cache->module_name = "gallery";
$cache->name = "_cache";
$cache->value = serialize(self::$var_cache);
- $cache->save();
+ try {
+ $cache->save();
+ } catch (Database_Exception $e) {
+ // There's a potential race condition here. Don't fail if that happens because it's
+ // bound to be transient and not a huge deal, but at least put something in the logs.
+ if (stristr($e->getMessage(), "duplicate entry")) {
+ Kohana_Log::add("error", "Failed to cache vars");
+ } else {
+ throw $e;
+ }
+ }
}
}