Use cronjob to delete old pages deployments
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]: https://gitlab.com/groups/gitlab-org/-/epics/10914 [introduced]: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/130848 Related to: https://gitlab.com/gitlab-org/gitlab/-/issues/425939 Changelog: changed
显示
- app/models/pages_deployment.rb 1 个添加, 0 个删除app/models/pages_deployment.rb
- app/services/projects/update_pages_service.rb 0 个添加, 5 个删除app/services/projects/update_pages_service.rb
- app/workers/all_queues.yml 9 个添加, 0 个删除app/workers/all_queues.yml
- app/workers/pages/deactivated_deployments_delete_cron_worker.rb 19 个添加, 0 个删除...rkers/pages/deactivated_deployments_delete_cron_worker.rb
- config/initializers/1_settings.rb 3 个添加, 0 个删除config/initializers/1_settings.rb
- db/migrate/20230927141237_add_index_on_pages_deployments_deleted_at.rb 18 个添加, 0 个删除...230927141237_add_index_on_pages_deployments_deleted_at.rb
- db/schema_migrations/20230927141237 1 个添加, 0 个删除db/schema_migrations/20230927141237
- db/structure.sql 2 个添加, 0 个删除db/structure.sql
- spec/services/projects/update_pages_service_spec.rb 19 个添加, 39 个删除spec/services/projects/update_pages_service_spec.rb
- spec/workers/pages/deactivated_deployments_delete_cron_worker_spec.rb 15 个添加, 0 个删除.../pages/deactivated_deployments_delete_cron_worker_spec.rb
加载中
想要评论请 注册 或 登录