in lib/core/job_cleanup.rb [38:63]
def process_idle_jobs(connector_id = nil)
Utility::Logger.debug("Start cleaning up idle jobs for #{connector_id ? "connector
idle_jobs = ConnectorJob.idle_jobs(connector_id)
if idle_jobs.empty?
Utility::Logger.debug('No idle jobs found. Skipping...')
return
end
marked_count = 0
idle_jobs.each do |job|
job.error!('The job has not seen any update for some time.')
Utility::Logger.debug("Successfully marked job #{job.id} as error.")
job_id = job.id
job = ConnectorJob.fetch_by_id(job_id)
Utility::Logger.warn("Could not found job by id #{job_id}") if job.nil?
Utility::Logger.warn("Could not found connector by id #{job.connector_id}") if job && job.connector.nil?
job&.connector&.update_last_sync!(job)
marked_count += 1
rescue StandardError => e
Utility::ExceptionTracking.log_exception(e)
end
Utility::Logger.info("Successfully marked #{marked_count} out of #{idle_jobs.count} idle jobs as error.")
end