Convert additional database methods to async (select list, search, insert_many, delete_*) (#8168)

This commit is contained in:
Patrick Cloke 2020-08-27 07:41:01 -04:00 committed by GitHub
parent 4a739c73b4
commit 30426c7063
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 67 additions and 84 deletions

View file

@ -14,7 +14,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import Dict, Iterable, List, Optional, Tuple
from typing import TYPE_CHECKING, Dict, Iterable, List, Optional, Tuple
from canonicaljson import encode_canonical_json
@ -27,6 +27,9 @@ from synapse.util import json_encoder
from synapse.util.caches.descriptors import cached, cachedList
from synapse.util.iterutils import batch_iter
if TYPE_CHECKING:
from synapse.handlers.e2e_keys import SignatureListItem
class EndToEndKeyWorkerStore(SQLBaseStore):
@trace
@ -730,14 +733,16 @@ class EndToEndKeyStore(EndToEndKeyWorkerStore, SQLBaseStore):
stream_id,
)
def store_e2e_cross_signing_signatures(self, user_id, signatures):
async def store_e2e_cross_signing_signatures(
self, user_id: str, signatures: "Iterable[SignatureListItem]"
) -> None:
"""Stores cross-signing signatures.
Args:
user_id (str): the user who made the signatures
signatures (iterable[SignatureListItem]): signatures to add
user_id: the user who made the signatures
signatures: signatures to add
"""
return self.db_pool.simple_insert_many(
await self.db_pool.simple_insert_many(
"e2e_cross_signing_signatures",
[
{