This commit is contained in:
Akim Mamedov
2023-11-15 22:25:44 +07:00
parent 12eea3122e
commit 83f2239443
3 changed files with 22 additions and 4 deletions

View File

@ -17,7 +17,7 @@
import { Fluence, type ClientConfig } from "@fluencelabs/js-client";
import { fromByteArray } from "base64-js";
// import { test as particleTest } from "./_aqua/finalize_particle.js";
import { test as particleTest } from "./_aqua/finalize_particle.js";
import {
registerHelloWorld,
helloTest,
@ -94,8 +94,7 @@ export const runTest = async (): Promise<TestResult> => {
console.log("running particle test...");
// TODO: Currently this behavior will timeout after TTL bcs this function don't call 'responseSrc'. Will be attended in the next updates
//await particleTest();
await particleTest();
const returnVal = {
hello,

View File

@ -50,6 +50,7 @@ export type CallAquaFunctionArgs = {
config: CallAquaFunctionConfig | undefined;
peer: FluencePeer;
args: { [key: string]: JSONValue | ArgCallbackFunction };
fireAndForget?: boolean;
};
export type CallAquaFunctionConfig = {
@ -61,6 +62,8 @@ export const callAquaFunction = async ({
config = {},
peer,
args,
// TODO: remove after LNG-286 is done
fireAndForget = false,
}: CallAquaFunctionArgs) => {
log.trace("calling aqua function %j", { script, config, args });
@ -88,7 +91,9 @@ export const callAquaFunction = async ({
registerParticleScopeService(peer, particle, service);
}
if (fireAndForget) {
registerParticleScopeService(peer, particle, responseService(resolve));
}
registerParticleScopeService(peer, particle, injectRelayService(peer));

View File

@ -615,6 +615,20 @@ export abstract class FluencePeer {
});
});
}
} else {
// TODO: remove after LNG-286 is done
// eslint-disable-next-line eqeqeq
if (
this.jsServiceHost.getHandler(
"callbackSrv",
"response",
item.particle.id,
) == null &&
item.result.nextPeerPks.length == 0
) {
// try to finish script
item.onSuccess({});
}
}
return connectionPromise;