diff --git a/backend/src/app/main.clj b/backend/src/app/main.clj index 8e41d0adb..18911e2dc 100644 --- a/backend/src/app/main.clj +++ b/backend/src/app/main.clj @@ -165,7 +165,7 @@ :fn (ig/ref :app.tasks.file-media-gc/handler)} {:id "file-xlog-gc" - :cron #app/cron "0 0 0 */1 * ?" ;; daily + :cron #app/cron "0 0 */2 * * ?" ;; every 2 hours :fn (ig/ref :app.tasks.file-xlog-gc/handler)} {:id "storage-gc" @@ -229,7 +229,7 @@ :app.tasks.file-xlog-gc/handler {:pool (ig/ref :app.db/pool) - :max-age (dt/duration {:hours 12}) + :max-age (dt/duration {:hours 6}) :metrics (ig/ref :app.metrics/metrics)} :app.tasks.telemetry/handler @@ -275,7 +275,6 @@ :handler (ig/ref :app.telemetry/handler) :name "telemetry"}}))) - (defmethod ig/init-key :default [_ data] data) (defmethod ig/prep-key :default [_ data] (d/without-nils data)) diff --git a/backend/src/app/tasks/file_xlog_gc.clj b/backend/src/app/tasks/file_xlog_gc.clj index 15a3fc6df..d18b9d6e3 100644 --- a/backend/src/app/tasks/file_xlog_gc.clj +++ b/backend/src/app/tasks/file_xlog_gc.clj @@ -36,8 +36,8 @@ (def ^:private sql:delete-files-xlog - "delete from task_completed - where scheduled_at < now() - ?::interval") + "delete from file_change + where created_at < now() - ?::interval") (defn- handler [{:keys [pool max-age]} _] @@ -45,5 +45,5 @@ (let [interval (db/interval max-age) result (db/exec-one! conn [sql:delete-files-xlog interval]) result (:next.jdbc/update-count result)] - (log/infof "removed %s rows from file_changes table" result) + (log/infof "removed %s rows from file_change table" result) nil)))