Follow-up from "Remove security findings periodically"

The following discussion from !44336 (merged) should be addressed:

  • @mbobin started a discussion: (+1 comment)

    @minac @lulalala I think there are a few of major problems here:

    1. It will not break the loop until the timeout or limit is reached. This is not ideal because it will do unnecessary loops.
    2. In the loop it used like destroy_batch(Ci::JobArtifact) || destroy_batch(Ci::PipelineArtifact) and because it returns always true, the destroy_batch(Ci::PipelineArtifact) is never called.
    3. Because destroy_batch accepts Ci::PipelineArtifact for destruction it means that it means that run_after_destroy will most likely fail when it will receive a pipeline artifact.

    I came across this change because it conflicted with the work that I'm doing for https://gitlab.com/gitlab-org/gitlab/-/issues/233939 in !42242 (merged)