Sets the default TTL for all particles originating from the peer with no TTL specified.
If the originating particle's TTL is defined then that value will be used
- If the option is not set default TTL will be 7000
- Value 0 (zero) is treated as if the option was not set
+ If the option is not set default TTL will be 7000
diff --git a/src/internal/FluencePeer.ts b/src/internal/FluencePeer.ts
index 2f8717da..285db03a 100644
--- a/src/internal/FluencePeer.ts
+++ b/src/internal/FluencePeer.ts
@@ -99,7 +99,6 @@ export interface PeerConfig {
* Sets the default TTL for all particles originating from the peer with no TTL specified.
* If the originating particle's TTL is defined then that value will be used
* If the option is not set default TTL will be 7000
- * Value 0 (zero) is treated as if the option was not set
*/
defaultTtlMs?: number;
}
@@ -177,7 +176,10 @@ export class FluencePeer {
this._keyPair = await KeyPair.randomEd25519();
}
- this._defaultTTL = config?.defaultTtlMs || DEFAULT_TTL;
+ this._defaultTTL =
+ config?.defaultTtlMs !== undefined // don't miss value 0 (zero)
+ ? config?.defaultTtlMs
+ : DEFAULT_TTL;
this._interpreter = await createInterpreter(config?.avmLogLevel || 'off');
diff --git a/src/internal/compilerSupport/v2.ts b/src/internal/compilerSupport/v2.ts
index f45cddae..0a7d8088 100644
--- a/src/internal/compilerSupport/v2.ts
+++ b/src/internal/compilerSupport/v2.ts
@@ -188,6 +188,17 @@ interface ServiceDef {
functions: Array;
}
+/**
+ * Options to configure Aqua function execution
+ */
+export interface FnConfig {
+ /**
+ * Sets the TTL (time to live) for particle responsible for the function execution
+ * If the option is not set the default TTL from FluencePeer config is used
+ */
+ ttl?: number;
+}
+
/**
* Convenience function to support Aqua `func` generation backend
* The compiler only need to generate a call the function and provide the corresponding definitions and the air script
@@ -437,7 +448,7 @@ const extractFunctionArgs = (
numberOfExpectedArgs: number,
): {
peer: FluencePeer;
- config?: { ttl?: number };
+ config?: FnConfig;
args: any[];
} => {
let peer: FluencePeer;
Parameters
@@ -134,7 +134,7 @@Returns Uint8Array
@@ -174,7 +174,7 @@Sets the default TTL for all particles originating from the peer with no TTL specified. If the originating particle's TTL is defined then that value will be used - If the option is not set default TTL will be 7000 - Value 0 (zero) is treated as if the option was not set
+ If the option is not set default TTL will be 7000Parameters
diff --git a/src/internal/FluencePeer.ts b/src/internal/FluencePeer.ts index 2f8717da..285db03a 100644 --- a/src/internal/FluencePeer.ts +++ b/src/internal/FluencePeer.ts @@ -99,7 +99,6 @@ export interface PeerConfig { * Sets the default TTL for all particles originating from the peer with no TTL specified. * If the originating particle's TTL is defined then that value will be used * If the option is not set default TTL will be 7000 - * Value 0 (zero) is treated as if the option was not set */ defaultTtlMs?: number; } @@ -177,7 +176,10 @@ export class FluencePeer { this._keyPair = await KeyPair.randomEd25519(); } - this._defaultTTL = config?.defaultTtlMs || DEFAULT_TTL; + this._defaultTTL = + config?.defaultTtlMs !== undefined // don't miss value 0 (zero) + ? config?.defaultTtlMs + : DEFAULT_TTL; this._interpreter = await createInterpreter(config?.avmLogLevel || 'off'); diff --git a/src/internal/compilerSupport/v2.ts b/src/internal/compilerSupport/v2.ts index f45cddae..0a7d8088 100644 --- a/src/internal/compilerSupport/v2.ts +++ b/src/internal/compilerSupport/v2.ts @@ -188,6 +188,17 @@ interface ServiceDef { functions: Array