Add TwentyORM query read timeout exception (#13603)
In this PR: - adding a try / catch around all ORM internal methods save, insert, upsert, findOne, ... - leveraging this error to prevent messageChannels to get FAILED - optimizing messaging BATCH_SIZE and THROTTLE threshold according to local tests - <img width="1510" height="851" alt="image" src="https://github.com/user-attachments/assets/802fd933-caac-4291-9cde-34a1ddf59c06" />
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
export const CALENDAR_THROTTLE_MAX_ATTEMPTS = 4;
|
||||
export const CALENDAR_THROTTLE_MAX_ATTEMPTS = 5;
|
||||
|
||||
+7
-2
@@ -1,6 +1,10 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
|
||||
import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service';
|
||||
import {
|
||||
TwentyORMException,
|
||||
TwentyORMExceptionCode,
|
||||
} from 'src/engine/twenty-orm/exceptions/twenty-orm.exception';
|
||||
import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager';
|
||||
import { CALENDAR_THROTTLE_MAX_ATTEMPTS } from 'src/modules/calendar/calendar-event-import-manager/constants/calendar-throttle-max-attempts';
|
||||
import {
|
||||
@@ -31,7 +35,7 @@ export class CalendarEventImportErrorHandlerService {
|
||||
) {}
|
||||
|
||||
public async handleDriverException(
|
||||
exception: CalendarEventImportDriverException,
|
||||
exception: CalendarEventImportDriverException | TwentyORMException,
|
||||
syncStep: CalendarEventImportSyncStep,
|
||||
calendarChannel: Pick<
|
||||
CalendarChannelWorkspaceEntity,
|
||||
@@ -47,6 +51,7 @@ export class CalendarEventImportErrorHandlerService {
|
||||
workspaceId,
|
||||
);
|
||||
break;
|
||||
case TwentyORMExceptionCode.QUERY_READ_TIMEOUT:
|
||||
case CalendarEventImportDriverExceptionCode.TEMPORARY_ERROR:
|
||||
await this.handleTemporaryException(
|
||||
syncStep,
|
||||
@@ -158,7 +163,7 @@ export class CalendarEventImportErrorHandlerService {
|
||||
}
|
||||
|
||||
private async handleUnknownException(
|
||||
exception: CalendarEventImportDriverException,
|
||||
exception: { message: string },
|
||||
calendarChannel: Pick<CalendarChannelWorkspaceEntity, 'id'>,
|
||||
workspaceId: string,
|
||||
): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user