Skip to content
Snippets Groups Projects
Commit f8a4788a authored by Peter Rotich's avatar Peter Rotich
Browse files

Queue: Cached Queue Counts

Clear cached queue counts on queue update and via auto-cron
parent eed26b57
Branches
Tags
No related merge requests found
......@@ -1349,11 +1349,10 @@ class CustomQueue extends VerySimpleModel {
$nopath = !isset($this->path);
$path_changed = isset($this->dirty['parent_id']);
if ($this->dirty) {
if ($this->dirty)
$this->updated = SqlFunction::NOW();
// Refetch the queue counts
SavedQueue::clearCounts();
}
$clearCounts = ($this->dirty || $this->__new__);
if (!($rv = parent::save($refetch || $this->dirty)))
return $rv;
......@@ -1372,6 +1371,11 @@ class CustomQueue extends VerySimpleModel {
};
$move_children($this);
}
// Refetch the queue counts
if ($clearCounts)
SavedQueue::clearCounts();
return $this->columns->saveAll()
&& $this->exports->saveAll()
&& $this->sorts->saveAll();
......
......@@ -47,7 +47,7 @@ require_once(INCLUDE_DIR.'class.cron.php');
// Run tickets count every 3rd run or so... force new count by skipping cached
// results
if (mt_rand(1, 12) == 3)
if ((mt_rand(1, 12) % 3) == 0)
SavedQueue::counts($thisstaff, array(), false);
// Clear staff obj to avoid false credit internal notes & auto-assignment
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment