Announcement

Collapse
No announcement yet.

'jobs' table & 'scheduled_job_log_record' table are not cleaned (500K+ records)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 'jobs' table & 'scheduled_job_log_record' table are not cleaned (500K+ records)

    How to clean them (manually)? and 'clean-up' job is active and runs daily at night... (config setting is 15 days)

  • #2
    Hello,
    do a simple job like this and run this each week:

    PHP Code:
    <?php 

    namespace Espo\Custom\Jobs;
    use 
    Espo\ORM\Entity;

    class 
    CleanJobs extends \Espo\Core\Jobs\Base
    {    
        public function 
    run()
        {
            
    $GLOBALS['log']->warning"Begin Jobs CleanJobs & Optimize");
            
    $pdo $this->getEntityManager()->getPDO();
            
    $sql "DELETE FROM scheduled_job_log_record WHERE status='Success';DELETE FROM job WHERE status='Success'";
            
    $sth $pdo->prepare($sql);
            
    $sth->execute();

            
    $sql "SHOW TABLES";
            
    $sth $pdo->prepare($sql);
            
    $sth->execute();
            
    $allTables$sth->fetchAll();
            foreach (
    $allTables as $table) {
                
    $sql 'OPTIMIZE TABLE ' .$table[0] ;
            }
            
    $GLOBALS['log']->warning"End Jobs CleanJobs & Optimize");
        }
    }

    Comment


    • #3
      They actually are being cleaned up.

      Comment

      Working...
      X