@sentio/runtime 2.57.12-rc.f → 2.57.12-rc.h

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.
@@ -39341,12 +39341,14 @@ var ServiceManager = class {
39341
39341
  this.options = options2;
39342
39342
  this.loader = loader2;
39343
39343
  this.shutdownHandler = shutdownHandler;
39344
+ this.workerData.options = options2;
39344
39345
  }
39345
39346
  started = false;
39346
39347
  // When there is unhandled error, stop process and return unavailable error
39347
39348
  unhandled;
39348
39349
  // private processorConfig: ProcessConfigResponse
39349
39350
  pool;
39351
+ workerData = {};
39350
39352
  async *preprocessBindingsStream(requests, context2) {
39351
39353
  throw new Error("not supported");
39352
39354
  }
@@ -39358,10 +39360,7 @@ var ServiceManager = class {
39358
39360
  bc.postMessage(request3);
39359
39361
  const newConfig = ProcessConfigResponse.fromPartial({});
39360
39362
  await PluginManager.INSTANCE.configure(newConfig);
39361
- this.pool.options.workerData = {
39362
- configRequest: request3,
39363
- ...this.pool.options.workerData
39364
- };
39363
+ this.workerData.configRequest = request3;
39365
39364
  return newConfig;
39366
39365
  }
39367
39366
  async start(request3, context2) {
@@ -39373,23 +39372,15 @@ var ServiceManager = class {
39373
39372
  } catch (e) {
39374
39373
  throw new import_nice_grpc.ServerError(import_nice_grpc.Status.INVALID_ARGUMENT, "Failed to load processor: " + errorString(e));
39375
39374
  }
39376
- this.pool = new Piscina({
39377
- maxThreads: this.options.worker,
39378
- minThreads: this.options.worker,
39379
- filename: new URL("./service-worker.js", import.meta.url).href.replaceAll("runtime/src", "runtime/lib"),
39380
- argv: process.argv,
39381
- workerData: {
39382
- startRequest: request3,
39383
- options: this.options
39384
- }
39385
- });
39386
39375
  await PluginManager.INSTANCE.start(request3);
39387
39376
  this.started = true;
39377
+ this.workerData.startRequest = request3;
39388
39378
  return {};
39389
39379
  }
39390
39380
  async stop(request3, context2) {
39391
- console.log("Server Shutting down in 5 seconds");
39381
+ await this.pool.destroy();
39392
39382
  if (this.shutdownHandler) {
39383
+ console.log("Server Shutting down in 5 seconds");
39393
39384
  setTimeout(this.shutdownHandler, 5e3);
39394
39385
  }
39395
39386
  return {};
@@ -39420,6 +39411,15 @@ var ServiceManager = class {
39420
39411
  if (!this.started) {
39421
39412
  throw new import_nice_grpc.ServerError(import_nice_grpc.Status.UNAVAILABLE, "Service Not started.");
39422
39413
  }
39414
+ if (!this.pool) {
39415
+ this.pool = new Piscina({
39416
+ maxThreads: this.options.worker,
39417
+ minThreads: this.options.worker,
39418
+ filename: new URL("./service-worker.js", import.meta.url).href.replaceAll("runtime/src", "runtime/lib"),
39419
+ argv: process.argv,
39420
+ workerData: this.workerData
39421
+ });
39422
+ }
39423
39423
  if (this.unhandled) {
39424
39424
  throw new import_nice_grpc_error_details.RichServerError(
39425
39425
  import_nice_grpc.Status.UNAVAILABLE,