           (try (Thread/sleep 1000) (catch InterruptedException _))
           ))
       (log/info "get metabadges: done")
-      )))
+      ))
 
 (defn- check-metabadges [ctx factory-url]
   (log/info "check for metabadges: started working")

        (when (> time-limit (System/currentTimeMillis))
          (doseq [user-badge chunk]
            (try
              (get-metabadge! ctx db-conn factory-url user-badge)
              (catch Throwable ex
                (log/error "get-metabadges failed")
                (log/error (.toString ex))

          AND deleted = 0 AND revoked = 0 AND status != 'declined'
          AND (expires_on IS NULL OR expires_on > UNIX_TIMESTAMP())
          ORDER BY last_checked LIMIT 1000"
          badges (filter #(and (not (nil? (:assertion_url %))) (string/starts-with? (:assertion_url %) factory-url)) (jdbc/query db-conn [sql]))]
      (doseq [chunk (partition-all 10 badges)]
        (when (> time-limit (System/currentTimeMillis))
          (doseq [user-badge chunk]
            (try
              (db/metabadge?! db-conn factory-url user-badge)
              (catch Throwable ex
                (log/error "check-metabadges failed")
                (log/error (.toString ex))
