@sentio/runtime 3.1.0-rc.1 → 3.1.0-rc.2
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/lib/{chunk-ROBPWJIE.js → chunk-WTF2W33M.js} +1 -2
- package/lib/{chunk-KVGBPLGJ.js → chunk-Z33FXCEF.js} +10535 -10514
- package/lib/{chunk-KVGBPLGJ.js.map → chunk-Z33FXCEF.js.map} +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +2 -2
- package/lib/processor-runner.js +10993 -190
- package/lib/processor-runner.js.map +1 -1
- package/package.json +1 -1
- package/src/processor-runner-program.ts +1 -8
- package/src/processor-runner.ts +6 -12
- package/lib/chunk-PCB4OKW7.js +0 -10975
- package/lib/chunk-PCB4OKW7.js.map +0 -1
- package/lib/service-worker.d.ts +0 -10
- package/lib/service-worker.js +0 -134
- package/lib/service-worker.js.map +0 -1
- package/src/service-manager.ts +0 -193
- package/src/service-worker.ts +0 -140
- /package/lib/{chunk-ROBPWJIE.js.map → chunk-WTF2W33M.js.map} +0 -0
package/package.json
CHANGED
|
@@ -7,12 +7,6 @@ try {
|
|
|
7
7
|
console.error('Failed to parse worker number', e)
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
let serverNum = 1
|
|
11
|
-
|
|
12
|
-
if (process.env['PROCESSOR_SERVER_NUM']) {
|
|
13
|
-
serverNum = parseInt(process.env['PROCESSOR_SERVER_NUM']!.trim())
|
|
14
|
-
}
|
|
15
|
-
|
|
16
10
|
function myParseInt(value: string, dummyPrevious: number): number {
|
|
17
11
|
// parseInt takes a string and a radix
|
|
18
12
|
const parsedValue = parseInt(value, 10)
|
|
@@ -38,7 +32,7 @@ export const program = new Command('processor-runner')
|
|
|
38
32
|
.option('--debug', 'Enable debug mode')
|
|
39
33
|
.option('--otlp-debug', 'Enable OTLP debug mode')
|
|
40
34
|
.option('--start-action-server', 'Start action server instead of processor server')
|
|
41
|
-
.option('--worker <number>', 'Number of worker threads
|
|
35
|
+
.option('--worker <number>', 'Number of processor worker threads ', myParseInt, workerNum)
|
|
42
36
|
.option('--process-timeout <seconds>', 'Process timeout in seconds', myParseInt, 60)
|
|
43
37
|
.option(
|
|
44
38
|
'--worker-timeout <seconds>',
|
|
@@ -51,7 +45,6 @@ export const program = new Command('processor-runner')
|
|
|
51
45
|
'Enable binding data partition',
|
|
52
46
|
process.env['SENTIO_ENABLE_BINDING_DATA_PARTITION'] === 'true'
|
|
53
47
|
)
|
|
54
|
-
.option('--multi-server <number>', 'Enable multi-server mode for processor runtime', myParseInt, serverNum)
|
|
55
48
|
|
|
56
49
|
export type ProcessorRuntimeOptions = ReturnType<typeof program.opts> & { target: string }
|
|
57
50
|
|
package/src/processor-runner.ts
CHANGED
|
@@ -20,7 +20,6 @@ import { setupLogger } from './logger.js'
|
|
|
20
20
|
|
|
21
21
|
import { setupOTLP } from './otlp.js'
|
|
22
22
|
import { ActionServer } from './action-server.js'
|
|
23
|
-
import { ServiceManager } from './service-manager.js'
|
|
24
23
|
import { ProcessorV3Definition } from '@sentio/protos'
|
|
25
24
|
import { ProcessorServiceImplV3 } from './service-v3.js'
|
|
26
25
|
import { dirname, join } from 'path'
|
|
@@ -50,13 +49,13 @@ console.debug('Starting Server', options)
|
|
|
50
49
|
const isChildProcess = process.env['SENTIO_MULTI_SERVER_CHILD'] === 'true'
|
|
51
50
|
const childServerPort = process.env['SENTIO_CHILD_SERVER_PORT']
|
|
52
51
|
|
|
53
|
-
// Multi-
|
|
54
|
-
if (options.
|
|
52
|
+
// Multi-worker mode: spawn child processes for additional servers
|
|
53
|
+
if (options.worker > 1 && !isChildProcess) {
|
|
55
54
|
const childProcesses: ChildProcess[] = []
|
|
56
55
|
const basePort = parseInt(options.port)
|
|
57
56
|
|
|
58
57
|
// Spawn child processes for ports basePort+1 to basePort+(multiServer-1)
|
|
59
|
-
for (let i = 1; i < options.
|
|
58
|
+
for (let i = 1; i < options.worker; i++) {
|
|
60
59
|
const childPort = basePort + i
|
|
61
60
|
const child = fork(fileURLToPath(import.meta.url), process.argv.slice(2), {
|
|
62
61
|
env: {
|
|
@@ -94,7 +93,7 @@ if (options.multiServer > 1 && !isChildProcess) {
|
|
|
94
93
|
const actualPort = isChildProcess && childServerPort ? childServerPort : options.port
|
|
95
94
|
|
|
96
95
|
let server: any
|
|
97
|
-
let baseService: ProcessorServiceImpl
|
|
96
|
+
let baseService: ProcessorServiceImpl
|
|
98
97
|
let httpServer: http.Server | undefined
|
|
99
98
|
|
|
100
99
|
const loader = async () => {
|
|
@@ -116,13 +115,8 @@ if (options.startActionServer) {
|
|
|
116
115
|
// .use(openTelemetryServerMiddleware())
|
|
117
116
|
.use(errorDetailsServerMiddleware)
|
|
118
117
|
|
|
119
|
-
// for
|
|
120
|
-
|
|
121
|
-
baseService = new ServiceManager(loader, options, server.shutdown)
|
|
122
|
-
} else {
|
|
123
|
-
baseService = new ProcessorServiceImpl(loader, options, server.shutdown)
|
|
124
|
-
}
|
|
125
|
-
|
|
118
|
+
// for V2
|
|
119
|
+
baseService = new ProcessorServiceImpl(loader, options, server.shutdown)
|
|
126
120
|
const service = new FullProcessorServiceImpl(baseService)
|
|
127
121
|
|
|
128
122
|
server.add(ProcessorDefinition, service)
|