@sentio/runtime 2.60.0-rc.13 → 2.60.0-rc.14

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": "2.60.0-rc.13",
3
+ "version": "2.60.0-rc.14",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
package/src/service-v3.ts CHANGED
@@ -10,6 +10,7 @@ import {
10
10
  ProcessorV3ServiceImplementation,
11
11
  ProcessResult,
12
12
  ProcessStreamRequest,
13
+ ProcessStreamResponse,
13
14
  ProcessStreamResponseV2,
14
15
  StartRequest
15
16
  } from '@sentio/protos'
@@ -52,6 +53,21 @@ export class ProcessorServiceImplV3 implements ProcessorV3ServiceImplementation
52
53
 
53
54
  async *processBindingsStream(requests: AsyncIterable<ProcessStreamRequest>, context: CallContext) {
54
55
  const subject = new Subject<DeepPartial<ProcessStreamResponseV2>>()
56
+ this.handleRequests(requests, subject)
57
+ .then(() => {
58
+ subject.complete()
59
+ })
60
+ .catch((e) => {
61
+ console.error(e)
62
+ subject.error(e)
63
+ })
64
+ yield* from(subject).pipe(withAbort(context.signal))
65
+ }
66
+
67
+ protected async handleRequests(
68
+ requests: AsyncIterable<ProcessStreamRequest>,
69
+ subject: Subject<DeepPartial<ProcessStreamResponse>>
70
+ ) {
55
71
  let lastBinding: DataBinding | undefined = undefined
56
72
  for await (const request of requests) {
57
73
  try {
@@ -65,8 +81,8 @@ export class ProcessorServiceImplV3 implements ProcessorV3ServiceImplementation
65
81
  console.error('unexpect error during handle loop', e)
66
82
  }
67
83
  }
68
- yield* from(subject).pipe(withAbort(context.signal))
69
84
  }
85
+
70
86
  private contexts = new Contexts()
71
87
 
72
88
  async handleRequest(
@@ -87,7 +103,7 @@ export class ProcessorServiceImplV3 implements ProcessorV3ServiceImplementation
87
103
 
88
104
  if (this.enablePartition) {
89
105
  try {
90
- console.debug(`sending partition request for processId ${request.processId}`, request.binding)
106
+ console.debug('sending partition request', request.binding)
91
107
  const partitions = await PluginManager.INSTANCE.partition(request.binding)
92
108
  subject.next({
93
109
  processId: request.processId,