[API] fix race between arrival of trash time and next sweep
As evidenced in #12790, there exists a race between when the trash time arrives for a collection, and the next trash sweep. During that period, accessing a collection by PDH results in a 401 ("Expired permission signature"). Tom put it like this:
Even with this config fixed, there's obviously a race condition that we need to fix between when trash time arrives and the next sweep. Here it's just glaringly obvious because the race window is forever.
In #12790 we noticed this problem because trash_sweep_interval was set to 0s.
#5 Updated by Tom Clegg about 1 year ago
- when getting a collection by PDH and there are multiple candidates, we might accidentally choose one that expires soon (or in the past), and give the client signatures that expire sooner than necessary (or are already expired and therefore completely useless)
- when getting a collection by UUID, and include_trash is false, we might return a trashed collection anyway, which is wrong
- when getting a list of collections, and include_trash is false, we might include some trashed collections in the results
- when getting a list of collections, and include_trash is false, we might include some trashed collections in the items_available count