• Kassio Borges's avatar
    Use cronjob to delete old pages deployments · eb3af4d0
    Kassio Borges authored and Tetiana Chupryna's avatar Tetiana Chupryna committed
    Currently, the deletion of deprecated pages deployments is based on the
    idea that each project must have only 1 active `PagesDeployment` in
    a given moment. With the work to introduce [Gitlab Pages Multiple
    Versions], a project now will have to support multiple `PagesDeployment`
    at the same time.
    For this reason, `PagesDeployment#deleted_at` field was [introduced] to
    enable us to delete deprecated jobs by setting their `deleted_at` to the
    minimal timestamp when it's safe to delete them from the database.
    Now, we're replacing the `DestroyPagesDeploymentsWorker` by
    `Pages::DeprecatedDeploymentsDeleteCronWorker` when creating a new pages
    deployment, which will delete only depreacted `PagesDeployment` records,
    in other words, all `PagesDeployment` records that where `deleted_at` is
    not in the future.
    [Gitlab Pages Multiple Versions]: &10914
    [introduced]: !130848