private function loadConfig()
 {
     $firstLoad = true;
     if (!is_null($this->schedulerConfig)) {
         $firstLoad = false;
         // check if the helper updated the config file
         clearstatcache();
         $current_file_time = filemtime($this->configFileName);
         if ($current_file_time <= $this->schedulerConfig->getFileTimestamp()) {
             return;
         }
         sleep(2);
         // make sure the file finsied to be written
     }
     $this->schedulerConfig = new KSchedulerConfig($this->configFileName);
     date_default_timezone_set($this->schedulerConfig->getTimezone());
     $this->cleanQueueFiltersDir();
     $this->queueSizes = array();
     if ($firstLoad) {
         KalturaLog::info(file_get_contents('VERSION.txt'));
     }
     KalturaLog::info("Loading configuration file at: " . date('Y-m-d H:i'));
     $configItems = $this->createConfigItem($this->schedulerConfig->getScheduler()->toArray());
     $taskConfigs = $this->schedulerConfig->getTaskConfigList();
     $this->logDir = $this->schedulerConfig->getLogDir();
     $this->maxExecutionTime = $this->schedulerConfig->getMaxExecutionTime();
     $this->statusInterval = $this->schedulerConfig->getStatusInterval();
     $this->schedulerStatusInterval = $this->schedulerConfig->getSchedulerStatusInterval();
     KDwhClient::setEnabled($this->schedulerConfig->getDwhEnabled());
     KDwhClient::setFileName($this->schedulerConfig->getDwhPath());
     $taskConfigsValidations = array();
     foreach ($taskConfigs as $taskConfig) {
         /* @var $taskConfig KSchedularTaskConfig */
         if (is_null($taskConfig->type)) {
             // is the scheduler itself
             continue;
         }
         if (isset($taskConfigsValidations[$taskConfig->id])) {
             KalturaLog::err("Duplicated worker id [{$taskConfig->id}] in worker names [{$taskConfig->name}] and [" . $taskConfigsValidations[$taskConfig->id] . "]");
             $this->keepRunning = false;
             return;
         }
         if (in_array($taskConfig->name, $taskConfigsValidations)) {
             KalturaLog::err("Duplicated worker name [{$taskConfig->name}] in worker ids [{$taskConfig->id}] and [" . array_search($taskConfig->name, $taskConfigsValidations) . "]");
             $this->keepRunning = false;
             return;
         }
         $taskConfigsValidations[$taskConfig->id] = $taskConfig->name;
         $vars = get_object_vars($taskConfig);
         $subConfigItems = $this->createConfigItem($vars, $taskConfig->id, $taskConfig->name);
         $configItems = array_merge($configItems, $subConfigItems);
     }
     KalturaLog::info("sending configuration to the server");
     KScheduleHelperManager::saveConfigItems($this->schedulerConfig->getConfigItemsFilePath(), $configItems);
     set_time_limit($this->maxExecutionTime);
     $this->initAllWorkers();
 }