Just always run in thread

This commit is contained in:
Itamar Turner-Trauring 2023-10-16 10:10:00 -04:00
parent d3ca02fa3f
commit 2ccdd183c1

View File

@ -638,10 +638,7 @@ async def read_encoded(
# Pycddl will release the GIL when validating larger documents, so
# let's take advantage of multiple CPUs:
if size > 10_000:
await defer_to_thread(reactor, schema.validate_cbor, message)
else:
schema.validate_cbor(message)
await defer_to_thread(reactor, schema.validate_cbor, message)
# The CBOR parser will allocate more memory, but at least we can feed
# it the file-like object, so that if it's large it won't be make two