limit DataStore.get_pending_root() query (#15607)

This commit is contained in:
Kyle Altendorf 2023-07-24 21:02:18 -04:00 committed by GitHub
parent 345f096192
commit 5052cc2fd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -369,7 +369,7 @@ class DataStore:
async def get_pending_root(self, tree_id: bytes32) -> Optional[Root]:
async with self.db_wrapper.reader() as reader:
cursor = await reader.execute(
"SELECT * FROM root WHERE tree_id == :tree_id AND status == :status",
"SELECT * FROM root WHERE tree_id == :tree_id AND status == :status LIMIT 2",
{"tree_id": tree_id, "status": Status.PENDING.value},
)