From 527361efd49be352d4c60a88e0429d6611e176c0 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Mon, 4 Jul 2022 00:57:42 +0100 Subject: [PATCH] Ensure script function is asynchronous --- lib/src/fnc/script.rs | 7 ++++++- lib/src/sql/function.rs | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/src/fnc/script.rs b/lib/src/fnc/script.rs index bb956ee9..4e048a20 100644 --- a/lib/src/fnc/script.rs +++ b/lib/src/fnc/script.rs @@ -105,7 +105,12 @@ impl Class for JsRecord { } } -pub fn run(ctx: &Context, src: &str, arg: Vec, doc: Option<&Value>) -> Result { +pub async fn run( + ctx: &Context<'_>, + src: &str, + arg: Vec, + doc: Option<&Value>, +) -> Result { // Check the context let _ = ctx.check()?; // Create an execution context diff --git a/lib/src/sql/function.rs b/lib/src/sql/function.rs index 23058678..9bb53eb5 100644 --- a/lib/src/sql/function.rs +++ b/lib/src/sql/function.rs @@ -136,7 +136,7 @@ impl Function { for v in x { a.push(v.compute(ctx, opt, txn, doc).await?); } - fnc::script::run(ctx, s, a, doc) + fnc::script::run(ctx, s, a, doc).await } #[cfg(not(feature = "scripting"))] {