We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 64b4836 commit f62de29Copy full SHA for f62de29
singlestoredb/functions/ext/asgi.py
@@ -319,11 +319,12 @@ async def do_func(
319
row_ids = array_cls(row_ids)
320
321
# Call the function with `cols` as the function parameters
322
- if cols and cols[0]:
323
- out = func(*[x if m else x[0] for x, m in zip(cols, masks)])
+ is_async = inspect.iscoroutinefunction(func) or inspect.iscoroutinefunction(getattr(func, "__wrapped__", None))
+ if is_async:
324
+ out = await func(*[x if m else x[0] for x, m in zip(cols, masks)])
325
else:
- out = func()
326
-
+ out = await asyncio.to_thread(func, *[x if m else x[0] for x, m in zip(cols, masks)])
327
+
328
# Single masked value
329
if isinstance(out, Masked):
330
return row_ids, [tuple(out)]
0 commit comments