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 { Fluence, type ClientConfig } from "@fluencelabs/js-client";
import { fromByteArray } from "base64-js"; import { fromByteArray } from "base64-js";
// import { test as particleTest } from "./_aqua/finalize_particle.js"; import { test as particleTest } from "./_aqua/finalize_particle.js";
import { import {
registerHelloWorld, registerHelloWorld,
helloTest, helloTest,
@ -94,8 +94,7 @@ export const runTest = async (): Promise<TestResult> => {
console.log("running particle test..."); 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 = { const returnVal = {
hello, hello,

View File

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