sharding (tickets): Filter expiring tickets.

Only expire tickets which are on this shard.
`THIS_SHARD` application is a no-op when unsharded.
This commit is contained in:
2021-12-22 13:20:27 +02:00
parent 1c05d7a880
commit 25e22c07d0
2 changed files with 6 additions and 3 deletions

View File

@@ -80,8 +80,9 @@ class SHARDID(Condition):
self.shard_count = shard_count
def apply(self, key, values, conditions):
conditions.append("({} >> 22) %% {} = {}".format(key, self.shard_count, _replace_char))
values.append(self.shardid)
if self.shard_count > 1:
conditions.append("({} >> 22) %% {} = {}".format(key, self.shard_count, _replace_char))
values.append(self.shardid)
THIS_SHARD = SHARDID(sharding.shard_number, sharding.shard_count)