Ensure script function is asynchronous
This commit is contained in:
parent
039d2fbd54
commit
527361efd4
2 changed files with 7 additions and 2 deletions
|
@ -105,7 +105,12 @@ impl Class for JsRecord {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run(ctx: &Context, src: &str, arg: Vec<Value>, doc: Option<&Value>) -> Result<Value, Error> {
|
pub async fn run(
|
||||||
|
ctx: &Context<'_>,
|
||||||
|
src: &str,
|
||||||
|
arg: Vec<Value>,
|
||||||
|
doc: Option<&Value>,
|
||||||
|
) -> Result<Value, Error> {
|
||||||
// Check the context
|
// Check the context
|
||||||
let _ = ctx.check()?;
|
let _ = ctx.check()?;
|
||||||
// Create an execution context
|
// Create an execution context
|
||||||
|
|
|
@ -136,7 +136,7 @@ impl Function {
|
||||||
for v in x {
|
for v in x {
|
||||||
a.push(v.compute(ctx, opt, txn, doc).await?);
|
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"))]
|
#[cfg(not(feature = "scripting"))]
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue