There is a scheduler, Prune Old Record Lists,
https://support.sugarcrm.com/documentation/sugar_versions/13.0/serve/administration_guide/system/schedulers/#Prune_Old_Record_Lists
which executes As Often As Possible. This scheduler will execute "optimize table record_lists" every 1 minute.
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function cleanOldRecordLists() {
global $timedate;
$GLOBALS['log']->info('----->Scheduler fired job of type cleanOldRecordLists()');
$delTime = time()-3600; // Nuke anything an hour old.
$hourAgo = $timedate->asDb($timedate->getNow()->modify("-1 hour"));
$db = DBManagerFactory::getInstance();
$query = "DELETE FROM record_list WHERE date_modified < '".$db->quote($hourAgo)."'";
$db->query($query,true);
$db->optimizeTable('record_list');
return true;
This table, record_list, is seldom populated with data, so there's little justification for running the table optimization part of the code.
-
Is it possible to modify the function so it only optimizes if data has been deleted?
-
Can we adjust the scheduler to run at irregular intervals in the Advanced Settings? Specifically, we want it to run once daily at a random time between 6 - 10 AM UTC.