@sentio/runtime 3.0.0-rc.10 → 3.0.0-rc.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentio/runtime",
3
- "version": "3.0.0-rc.10",
3
+ "version": "3.0.0-rc.12",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
package/src/service-v3.ts CHANGED
@@ -29,6 +29,9 @@ import { ProcessorRuntimeOptions } from 'processor-runner-program.js'
29
29
 
30
30
  const { process_binding_count, process_binding_time, process_binding_error } = processMetrics
31
31
 
32
+ const WRITE_V2_EVENT_LOGS = process.env.WRITE_V2_EVENT_LOGS !== 'false'
33
+ const TIME_SERIES_RESULT_BATCH_SIZE = 1000
34
+
32
35
  export class ProcessorServiceImplV3 implements ProcessorV3ServiceImplementation {
33
36
  readonly enablePartition: boolean
34
37
  private readonly loader: () => Promise<any>
@@ -172,28 +175,23 @@ export class ProcessorServiceImplV3 implements ProcessorV3ServiceImplementation
172
175
  await context.awaitPendings()
173
176
  const { timeseriesResult, ...otherResults } = result
174
177
  console.debug('sending ts data length:', result.timeseriesResult.length)
175
- for (const ts of timeseriesResult) {
178
+ for (let i = 0; i < timeseriesResult.length; i += TIME_SERIES_RESULT_BATCH_SIZE) {
179
+ const batch = timeseriesResult.slice(i, i + TIME_SERIES_RESULT_BATCH_SIZE)
176
180
  subject.next({
177
181
  processId,
178
182
  tsRequest: {
179
- data: [ts]
183
+ data: batch
180
184
  }
181
185
  })
182
186
  }
183
187
 
184
- /* if (result.states?.configUpdated) {
185
- console.debug('sending tpl updates:')
186
- subject.next({
187
- processId,
188
- tplRequest: {
189
- templates: TemplateInstanceState.INSTANCE.getValues()
190
- }
191
- })
192
- }*/
193
-
194
188
  console.debug('sending binding result', processId)
195
189
  subject.next({
196
- result: otherResults,
190
+ result: WRITE_V2_EVENT_LOGS
191
+ ? otherResults
192
+ : {
193
+ states: otherResults.states
194
+ },
197
195
  processId: processId
198
196
  })
199
197
  recordRuntimeInfo(result, binding.handlerType)