Remove fire and forget

This commit is contained in:
Akim Mamedov 2023-11-18 18:55:58 +07:00
parent 7c2480527a
commit 327375fcbe
4 changed files with 4 additions and 37 deletions

View File

@ -133,7 +133,6 @@ export const v5_callFunction = async (
peer: peerOrArg,
args: callArgs,
config,
fireAndForget: returnTypeVoid,
});
if (returnTypeVoid) {

View File

@ -61,8 +61,6 @@ 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 });
@ -82,12 +80,7 @@ export const callAquaFunction = async ({
registerParticleScopeService(peer, particle, service);
}
// If fireAndForget is enabled, then function call completed when one of the two conditions is met:
// 1. The particle is sent to the network
// 2. All CallRequests are executed, e.g., all variable loading and local function calls are completed
if (!fireAndForget) {
registerParticleScopeService(peer, particle, responseService(resolve));
}
registerParticleScopeService(peer, particle, responseService(resolve));
registerParticleScopeService(peer, particle, injectRelayService(peer));

View File

@ -539,17 +539,6 @@ export abstract class FluencePeer {
"id %s. send successful",
newParticle.id,
);
if (
this.jsServiceHost.getHandler(
"callbackSrv",
"response",
item.particle.id,
) == null
) {
// try to finish script if fire-and-forget enabled
item.onSuccess(null);
}
})
.catch((e: unknown) => {
log_particle.error(
@ -627,21 +616,6 @@ 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
) {
// try to finish script if fire-and-forget enabled
setTimeout(() => {
item.onSuccess(null);
}, 0);
}
}
return connectionPromise;

View File

@ -312,10 +312,11 @@ export const builtInServices: Record<
}),
concat: withSchema(z.array(z.array(z.unknown())))((args) => {
// concat accepts only 'never' type
// Schema is used with unknown type to prevent useless runtime check
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
const arr = args as never[][];
return success([].concat(...arr));
return success(arr.flat());
}),
string_to_b58: withSchema(z.tuple([z.string()]))(([input]) => {