@sentio/runtime 2.57.13-rc.1 → 2.57.13-rc.10

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/test-processor.test.ts"],"sourcesContent":["import { Plugin, PluginManager } from './plugin.js'\nimport { DataBinding, HandlerType, ProcessResult } from './gen/processor/protos/processor.js'\n\nclass TestPlugin extends Plugin {\n async processBinding(request: DataBinding): Promise<ProcessResult> {\n const dbContext = PluginManager.INSTANCE.dbContextLocalStorage.getStore()\n if (dbContext) {\n await dbContext.sendRequest({\n get: {\n entity: 'Test',\n id: '1'\n }\n })\n }\n\n return ProcessResult.fromPartial({\n states: {\n configUpdated: true\n }\n })\n }\n supportedHandlers = [HandlerType.UNKNOWN]\n}\n\nPluginManager.INSTANCE.plugins = []\nPluginManager.INSTANCE.register(new TestPlugin())\n;import(\"node:process\").then((p) => p.stdout.write(\"\"));"],"mappings":";;;;;;;;AAGA,IAAM,aAAN,cAAyB,OAAO;AAAA,EAC9B,MAAM,eAAe,SAA8C;AACjE,UAAM,YAAY,cAAc,SAAS,sBAAsB,SAAS;AACxE,QAAI,WAAW;AACb,YAAM,UAAU,YAAY;AAAA,QAC1B,KAAK;AAAA,UACH,QAAQ;AAAA,UACR,IAAI;AAAA,QACN;AAAA,MACF,CAAC;AAAA,IACH;AAEA,WAAO,cAAc,YAAY;AAAA,MAC/B,QAAQ;AAAA,QACN,eAAe;AAAA,MACjB;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EACA,oBAAoB,gBAAoB;AAC1C;AAEA,cAAc,SAAS,UAAU,CAAC;AAClC,cAAc,SAAS,SAAS,IAAI,WAAW,CAAC;AAC/C,OAAO,cAAc,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,MAAM,EAAE,CAAC;","names":[]}
1
+ {"version":3,"sources":["../src/test-processor.test.ts"],"sourcesContent":["import { Plugin, PluginManager } from './plugin.js'\nimport { DataBinding, HandlerType, ProcessResult } from './gen/processor/protos/processor.js'\n\nclass TestPlugin extends Plugin {\n async processBinding(request: DataBinding): Promise<ProcessResult> {\n const dbContext = PluginManager.INSTANCE.dbContextLocalStorage.getStore()\n if (dbContext) {\n await dbContext.sendRequest({\n get: {\n entity: 'Test',\n id: '1'\n }\n })\n }\n\n return ProcessResult.fromPartial({\n states: {\n configUpdated: true\n }\n })\n }\n supportedHandlers = [HandlerType.UNKNOWN, HandlerType.ETH_LOG]\n}\n\nPluginManager.INSTANCE.plugins = []\nPluginManager.INSTANCE.register(new TestPlugin())\n;import(\"node:process\").then((p) => p.stdout.write(\"\"));"],"mappings":";;;;;;;;AAGA,IAAM,aAAN,cAAyB,OAAO;AAAA,EAC9B,MAAM,eAAe,SAA8C;AACjE,UAAM,YAAY,cAAc,SAAS,sBAAsB,SAAS;AACxE,QAAI,WAAW;AACb,YAAM,UAAU,YAAY;AAAA,QAC1B,KAAK;AAAA,UACH,QAAQ;AAAA,UACR,IAAI;AAAA,QACN;AAAA,MACF,CAAC;AAAA,IACH;AAEA,WAAO,cAAc,YAAY;AAAA,MAC/B,QAAQ;AAAA,QACN,eAAe;AAAA,MACjB;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EACA,oBAAoB,iCAAyC;AAC/D;AAEA,cAAc,SAAS,UAAU,CAAC;AAClC,cAAc,SAAS,SAAS,IAAI,WAAW,CAAC;AAC/C,OAAO,cAAc,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,MAAM,EAAE,CAAC;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentio/runtime",
3
- "version": "2.57.13-rc.1",
3
+ "version": "2.57.13-rc.10",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -24,6 +24,12 @@ import { ServiceManager } from './service-manager.js'
24
24
 
25
25
  // const mergedRegistry = Registry.merge([globalRegistry, niceGrpcRegistry])
26
26
 
27
+ let workerNum = 1
28
+ try {
29
+ workerNum = parseInt(process.env['PROCESSOR_WORKER']?.trim() ?? '1')
30
+ } catch (e) {
31
+ console.error('Failed to parse worker number', e)
32
+ }
27
33
  export const optionDefinitions = [
28
34
  { name: 'target', type: String, defaultOption: true },
29
35
  { name: 'port', alias: 'p', type: String, defaultValue: '4000' },
@@ -42,7 +48,7 @@ export const optionDefinitions = [
42
48
  { name: 'debug', type: Boolean, defaultValue: false },
43
49
  { name: 'otlp-debug', type: Boolean, defaultValue: false },
44
50
  { name: 'start-action-server', type: Boolean, defaultValue: false },
45
- { name: 'worker', type: Number, defaultValue: process.env['PROCESSOR_WORKER'] ?? 1 }
51
+ { name: 'worker', type: Number, defaultValue: workerNum }
46
52
  ]
47
53
 
48
54
  const options = commandLineArgs(optionDefinitions, { partial: true })
@@ -108,7 +108,7 @@ export class ServiceManager extends ProcessorServiceImpl {
108
108
  const dbContext = this.contexts.new(request.processId, subject)
109
109
 
110
110
  const start = Date.now()
111
- await this.process(binding, dbContext)
111
+ this.process(binding, dbContext)
112
112
  .then(async (result) => {
113
113
  subject.next({
114
114
  result,
@@ -144,6 +144,7 @@ export class ServiceManager extends ProcessorServiceImpl {
144
144
  if (this.pool) {
145
145
  await this.pool.close()
146
146
  }
147
+ console.info('Initializing worker pool with worker count:', this.options.worker)
147
148
  this.pool = new Piscina({
148
149
  maxThreads: this.options.worker,
149
150
  minThreads: this.options.worker,