Skip to content

Commit

Permalink
Rename eventHandler map
Browse files Browse the repository at this point in the history
  • Loading branch information
srknzl committed Jan 14, 2022
1 parent d05321a commit 9cf2299
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/invocation/InvocationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ const backupListenerCodec: ListenerMessageCodec = {
export class InvocationService {

private readonly doInvoke: (invocation: Invocation) => void;
private readonly eventHandlers: Map<number, Invocation> = new Map();
private readonly invocationsWithEventHandlers: Map<number, Invocation> = new Map();
private readonly pending: Map<number, Invocation> = new Map();
readonly invocationRetryPauseMillis: number;
readonly invocationTimeoutMillis: number;
Expand Down Expand Up @@ -437,7 +437,7 @@ export class InvocationService {
* Removes the handler for all event handlers with a specific correlation id.
*/
removeEventHandler(correlationId: number): void {
this.eventHandlers.delete(correlationId);
this.invocationsWithEventHandlers.delete(correlationId);
}

backupEventHandler(clientMessage: ClientMessage): void {
Expand All @@ -460,9 +460,9 @@ export class InvocationService {

if (clientMessage.startFrame.hasEventFlag() || clientMessage.startFrame.hasBackupEventFlag()) {
process.nextTick(() => {
const eventHandler = this.eventHandlers.get(correlationId);
if (eventHandler !== undefined) {
eventHandler.eventHandler(clientMessage);
const invocation = this.invocationsWithEventHandlers.get(correlationId);
if (invocation !== undefined) {
invocation.eventHandler(clientMessage);
}
});
return;
Expand Down Expand Up @@ -631,7 +631,7 @@ export class InvocationService {
message.setPartitionId(-1);
}
if (invocation.hasOwnProperty('eventHandler')) {
this.eventHandlers.set(correlationId, invocation);
this.invocationsWithEventHandlers.set(correlationId, invocation);
}
this.pending.set(correlationId, invocation);
}
Expand Down

0 comments on commit 9cf2299

Please sign in to comment.