@scrypted/server 0.123.32 → 0.123.33

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.
Files changed (44) hide show
  1. package/dist/plugin/plugin-host.d.ts +1 -1
  2. package/dist/plugin/plugin-host.js +11 -10
  3. package/dist/plugin/plugin-host.js.map +1 -1
  4. package/dist/plugin/plugin-remote-worker.js +10 -9
  5. package/dist/plugin/plugin-remote-worker.js.map +1 -1
  6. package/dist/plugin/runtime/child-process-worker.d.ts +1 -1
  7. package/dist/plugin/runtime/child-process-worker.js +2 -2
  8. package/dist/plugin/runtime/child-process-worker.js.map +1 -1
  9. package/dist/plugin/runtime/cluster-fork-worker.d.ts +2 -2
  10. package/dist/plugin/runtime/cluster-fork-worker.js +7 -3
  11. package/dist/plugin/runtime/cluster-fork-worker.js.map +1 -1
  12. package/dist/plugin/runtime/custom-worker.d.ts +1 -1
  13. package/dist/plugin/runtime/custom-worker.js +3 -3
  14. package/dist/plugin/runtime/custom-worker.js.map +1 -1
  15. package/dist/plugin/runtime/node-fork-worker.d.ts +1 -1
  16. package/dist/plugin/runtime/node-fork-worker.js +2 -2
  17. package/dist/plugin/runtime/node-fork-worker.js.map +1 -1
  18. package/dist/plugin/runtime/python-worker.d.ts +1 -1
  19. package/dist/plugin/runtime/python-worker.js +3 -3
  20. package/dist/plugin/runtime/python-worker.js.map +1 -1
  21. package/dist/plugin/runtime/runtime-host.d.ts +1 -1
  22. package/dist/plugin/runtime/runtime-host.js +3 -3
  23. package/dist/plugin/runtime/runtime-host.js.map +1 -1
  24. package/dist/scrypted-cluster-main.d.ts +2 -1
  25. package/dist/scrypted-cluster-main.js +12 -14
  26. package/dist/scrypted-cluster-main.js.map +1 -1
  27. package/dist/scrypted-server-main.js +1 -0
  28. package/dist/scrypted-server-main.js.map +1 -1
  29. package/dist/services/cluster-fork.d.ts +2 -1
  30. package/dist/services/cluster-fork.js +4 -3
  31. package/dist/services/cluster-fork.js.map +1 -1
  32. package/package.json +2 -2
  33. package/python/plugin_remote.py +15 -2
  34. package/src/plugin/plugin-host.ts +25 -21
  35. package/src/plugin/plugin-remote-worker.ts +16 -10
  36. package/src/plugin/runtime/child-process-worker.ts +3 -1
  37. package/src/plugin/runtime/cluster-fork-worker.ts +15 -9
  38. package/src/plugin/runtime/custom-worker.ts +3 -3
  39. package/src/plugin/runtime/node-fork-worker.ts +2 -2
  40. package/src/plugin/runtime/python-worker.ts +3 -3
  41. package/src/plugin/runtime/runtime-host.ts +4 -4
  42. package/src/scrypted-cluster-main.ts +16 -21
  43. package/src/scrypted-server-main.ts +1 -0
  44. package/src/services/cluster-fork.ts +6 -4
@@ -100,6 +100,7 @@ app.use(bodyParser.raw({ type: 'application/*', limit: 100000000 }) as any)
100
100
  async function start(mainFilename: string, options?: {
101
101
  onRuntimeCreated?: (runtime: ScryptedRuntime) => Promise<void>,
102
102
  }) {
103
+ console.log('Cluster server starting.');
103
104
  const volumeDir = getScryptedVolume();
104
105
  await fs.promises.mkdir(volumeDir, {
105
106
  recursive: true
@@ -1,11 +1,13 @@
1
+ import { ClusterWorker } from "@scrypted/types";
1
2
  import { matchesClusterLabels } from "../cluster/cluster-labels";
2
3
  import type { ScryptedRuntime } from "../runtime";
3
4
  import type { ClusterForkOptions, ClusterForkParam, PeerLiveness, RunningClusterWorker } from "../scrypted-cluster-main";
5
+ import type { RuntimeWorkerOptions } from "../plugin/runtime/runtime-worker";
4
6
 
5
7
  export class ClusterForkService {
6
8
  constructor(public runtime: ScryptedRuntime) { }
7
9
 
8
- async fork(peerLiveness: PeerLiveness, options: ClusterForkOptions, packageJson: any, zipHash: string, getZip: () => Promise<Buffer>) {
10
+ async fork(runtimeWorkerOptions: RuntimeWorkerOptions, options: ClusterForkOptions, peerLiveness: PeerLiveness, getZip: () => Promise<Buffer>) {
9
11
  const matchingWorkers = [...this.runtime.clusterWorkers.entries()].map(([id, worker]) => ({
10
12
  worker,
11
13
  matches: matchesClusterLabels(options, worker.labels),
@@ -34,8 +36,8 @@ export class ClusterForkService {
34
36
  }
35
37
 
36
38
  const fork: ClusterForkParam = await worker.peer.getParam('fork');
37
- const forkResult = await fork(peerLiveness, options.runtime, packageJson, zipHash, getZip);
38
- options.id ||= this.runtime.findPluginDevice(packageJson.name)?._id;
39
+ const forkResult = await fork(options.runtime, runtimeWorkerOptions, peerLiveness, getZip);
40
+ options.id ||= this.runtime.findPluginDevice(runtimeWorkerOptions.packageJson.name)?._id;
39
41
  worker.forks.add(options);
40
42
  forkResult.waitKilled().catch(() => { }).finally(() => {
41
43
  worker.forks.delete(options);
@@ -43,7 +45,7 @@ export class ClusterForkService {
43
45
 
44
46
  forkResult.clusterWorkerId = worker.id;
45
47
  return forkResult;
46
- }
48
+ };
47
49
 
48
50
  async getClusterWorkers() {
49
51
  const ret: any = {};