batches: revise query for changeset spec expiry
Created by: courier-new
Closes https://github.com/sourcegraph/sourcegraph/issues/20170, maybe.
Modifies the query for deleting changeset specs so that it will only flag a changeset spec that isn't attached to a changeset but is attached to an un-applied batch spec IF that changeset spec is also older than BatchSpecTTL
.
I say this maybe closes that issue because I'm not sure if checking the age of the changeset spec is enough, or if I should actually be checking whether or not the associated batch spec is older than BatchSpecTTL
.
Since the batch spec deletion happens after the changeset deletion, I believe no action is needed to preserve the existing behavior for also deleting the batch specs associated with these changeset specs after BatchSpecTTL
elapses.