                       [public-settings :as public-settings]
                       [task :as task])))
 
-(def ^:private ^:const upgrade-checks-job-key     "metabase.task.upgrade-checks.job")
-(def ^:private ^:const upgrade-checks-trigger-key "metabase.task.upgrade-checks.trigger")
+(def ^:private ^:const job-key     "metabase.task.upgrade-checks.job")
+(def ^:private ^:const trigger-key "metabase.task.upgrade-checks.trigger")
 
-(defonce ^:private upgrade-checks-job (atom nil))
-(defonce ^:private upgrade-checks-trigger (atom nil))
+(defonce ^:private job     (atom nil))
+(defonce ^:private trigger (atom nil))
 
 (defn- get-version-info []
   (let [version-info-url      (config/config-str :mb-version-info-url)

(ns metabase.task.upgrade-checks
  "Contains a Metabase task which periodically checks for the availability of new Metabase versions."
  (:require [cheshire.core :as json]
            [clj-http.client :as http]
            [clojure.tools.logging :as log]
            (clojurewerkz.quartzite [jobs :as jobs]
                                    [triggers :as triggers])
            [clojurewerkz.quartzite.schedule.cron :as cron]

  "Job initialization"
  []
  ;; build our job
  (reset! job (jobs/build
               (jobs/of-type CheckForNewVersions)
               (jobs/with-identity (jobs/key job-key))))
  ;; build our trigger
  (reset! trigger (triggers/build
                   (triggers/with-identity (triggers/key trigger-key))
                   (triggers/start-now)
                   (triggers/with-schedule
                     ;; run twice a day
                     (cron/cron-schedule "0 15 6,18 * * ? *"))))
  ;; submit ourselves to the scheduler
  (task/schedule-task! @job @trigger))
