@pylonsync/sdk 0.22.7 → 0.22.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +7 -0
- package/package.json +1 -1
- package/src/index.ts +10 -0
package/dist/index.d.ts
CHANGED
|
@@ -839,6 +839,13 @@ export interface ManifestShard {
|
|
|
839
839
|
/** Inputs applied per subscriber per tick. Default 32. */
|
|
840
840
|
maxPerTick?: number;
|
|
841
841
|
};
|
|
842
|
+
/** A function to run when a shard of this kind ends, with
|
|
843
|
+
* `{ shardId, kind, reason }`. `reason` is `"stopped"`
|
|
844
|
+
* (`ctx.shards.stop`), `"idle"` (no subscribers for `idleShutdownSecs`),
|
|
845
|
+
* `"finished"`, or `"failed"`. It runs as a background job with admin
|
|
846
|
+
* auth, so it can be `internal: true`. A machine shutting down or moving
|
|
847
|
+
* the shard to another machine does not run it. */
|
|
848
|
+
onStop?: string;
|
|
842
849
|
}
|
|
843
850
|
/**
|
|
844
851
|
* Declare a realtime shard kind whose simulation is a WebAssembly module.
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1082,6 +1082,13 @@ export interface ManifestShard {
|
|
|
1082
1082
|
/** Inputs applied per subscriber per tick. Default 32. */
|
|
1083
1083
|
maxPerTick?: number;
|
|
1084
1084
|
};
|
|
1085
|
+
/** A function to run when a shard of this kind ends, with
|
|
1086
|
+
* `{ shardId, kind, reason }`. `reason` is `"stopped"`
|
|
1087
|
+
* (`ctx.shards.stop`), `"idle"` (no subscribers for `idleShutdownSecs`),
|
|
1088
|
+
* `"finished"`, or `"failed"`. It runs as a background job with admin
|
|
1089
|
+
* auth, so it can be `internal: true`. A machine shutting down or moving
|
|
1090
|
+
* the shard to another machine does not run it. */
|
|
1091
|
+
onStop?: string;
|
|
1085
1092
|
}
|
|
1086
1093
|
|
|
1087
1094
|
/**
|
|
@@ -1150,6 +1157,9 @@ function validateShard(def: ManifestShard): void {
|
|
|
1150
1157
|
checkInt(def.input?.burst, "input.burst", 1, 100_000);
|
|
1151
1158
|
checkInt(def.input?.maxQueued, "input.maxQueued", 1, 100_000);
|
|
1152
1159
|
checkInt(def.input?.maxPerTick, "input.maxPerTick", 1, 100_000);
|
|
1160
|
+
if (def.onStop !== undefined && (typeof def.onStop !== "string" || def.onStop === "")) {
|
|
1161
|
+
fail("onStop must be a function name");
|
|
1162
|
+
}
|
|
1153
1163
|
}
|
|
1154
1164
|
|
|
1155
1165
|
/** One environment variable the app declares it needs. */
|