Class: DailyGoogleCalendarCheckWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Status::Worker, Sidekiq::Worker
Defined in:
app/workers/daily_google_calendar_check_worker.rb

Instance Method Summary collapse

Instance Method Details

#performObject

Check all employees in the PTO system for Google Calendar auth status

  • Updates the cached status for fast dashboard loading
  • If auth is valid: verify holidays are synced correctly
  • If auth is invalid/missing: send email asking them to reconnect


11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/workers/daily_google_calendar_check_worker.rb', line 11

def perform
  employees = Employee.active_employees.joins(:work_schedules).distinct.includes(account: :authentications)

  total(employees.count)

  employees.find_each.with_index do |employee, index|
    at(index + 1, "Checking #{employee.full_name}")
    check_employee(employee)
  rescue StandardError => e
    Rails.logger.error("DailyGoogleCalendarCheckWorker failed for employee #{employee.id}: #{e.message}")
  end
end