message: Only update the op event idle timer when at least one message is sequenced
diff: @@ -110,7 +110,7 @@ export class DeliLambda extends EventEmitter implements IPartitionLambda {
  // Op event properties
  private opIdleTimer: any | undefined;
  private opMaxTimeTimer: any | undefined;
  - private messagesSinceLastOpEvent: number = 0;
  + private sequencedMessagesSinceLastOpEvent: number = 0;
  private noActiveClients: boolean;
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
  @@ -186,6 +186,8 @@ export class DeliLambda extends EventEmitter implements IPartitionLambda {
  this.logOffset = rawMessage.offset;
  + let sequencedMessageCount = 0;
  +
  const boxcar = extractBoxcar(rawMessage);
  for (const message of boxcar.contents) {
  @@ -226,7 +228,7 @@ export class DeliLambda extends EventEmitter implements IPartitionLambda {
  this.lastSentMSN = ticketedMessage.msn;
  this.lastSendP = this.sendToScriptorium(ticketedMessage.message);
  - this.messagesSinceLastOpEvent++;
  + sequencedMessageCount++;
  }
  kafkaCheckpointMessage = this.getKafkaCheckpointMessage(rawMessage);
  @@ -262,15 +264,20 @@ export class DeliLambda extends EventEmitter implements IPartitionLambda {
  this.clearActivityIdleTimer();
  this.setActivityIdleTimer();
  - if (this.serviceConfiguration.deli.opEvent.enable) {
  + // Update the op event idle & max ops counter if ops were just sequenced
  + if (this.serviceConfiguration.deli.opEvent.enable && sequencedMessageCount > 0) {
  this.updateOpIdleTimer();
  const maxOps = this.serviceConfiguration.deli.opEvent.maxOps;
  - if (maxOps !== undefined && this.messagesSinceLastOpEvent > maxOps) {
  + if (maxOps !== undefined) {
  + this.sequencedMessagesSinceLastOpEvent += sequencedMessageCount;
  +
  + if (this.sequencedMessagesSinceLastOpEvent > maxOps) {
  this.emitOpEvent(OpEventType.MaxOps);
  }
  }
  }
  + }
  public close() {
  this.checkpointContext.close();
  @@ -877,7 +884,7 @@ export class DeliLambda extends EventEmitter implements IPartitionLambda {
  /**
  * Reset the op event idle timer
  - * Called after a kafka message is processed
  + * Called after a message is sequenced
  */
  private updateOpIdleTimer() {
  const idleTime = this.serviceConfiguration.deli.opEvent.idleTime;
  @@ -928,14 +935,14 @@ export class DeliLambda extends EventEmitter implements IPartitionLambda {
  * Also resets the MaxTime timer
  */
  private emitOpEvent(type: OpEventType) {
  - if (this.messagesSinceLastOpEvent === 0) {
  + if (this.sequencedMessagesSinceLastOpEvent === 0) {
  // no need to emit since no messages were handled since last time
  return;
  }
  - this.emit("opEvent", type, this.sequenceNumber, this.messagesSinceLastOpEvent);
  + this.emit("opEvent", type, this.sequenceNumber, this.sequencedMessagesSinceLastOpEvent);
  - this.messagesSinceLastOpEvent = 0;
  + this.sequencedMessagesSinceLastOpEvent = 0;
  this.updateOpMaxTimeTimer();
  }
  