From fa0b9bf9353b78542ca02352cbb59232dadbe8b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20S=C3=B3jko?= Date: Mon, 13 Feb 2023 10:52:06 +0100 Subject: [PATCH] fix(syncing-server): worker container configuration --- .../src/Bootstrap/CommonContainerConfigLoader.ts | 11 +++++++++++ .../src/Bootstrap/ServerContainerConfigLoader.ts | 10 ---------- packages/syncing-server/src/Bootstrap/Types.ts | 1 - .../src/Bootstrap/WorkerContainerConfigLoader.ts | 4 ---- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/packages/syncing-server/src/Bootstrap/CommonContainerConfigLoader.ts b/packages/syncing-server/src/Bootstrap/CommonContainerConfigLoader.ts index 16c21871a..a2c0bb2cb 100644 --- a/packages/syncing-server/src/Bootstrap/CommonContainerConfigLoader.ts +++ b/packages/syncing-server/src/Bootstrap/CommonContainerConfigLoader.ts @@ -16,6 +16,8 @@ import { SNSDomainEventPublisher } from '@standardnotes/domain-events-infra' import { DomainEventFactoryInterface } from '../Domain/Event/DomainEventFactoryInterface' import { DomainEventFactory } from '../Domain/Event/DomainEventFactory' import { Timer, TimerInterface } from '@standardnotes/time' +import { ItemTransferCalculatorInterface } from '../Domain/Item/ItemTransferCalculatorInterface' +import { ItemTransferCalculator } from '../Domain/Item/ItemTransferCalculator' // eslint-disable-next-line @typescript-eslint/no-var-requires const newrelicFormatter = require('@newrelic/winston-enricher') @@ -103,6 +105,15 @@ export class CommonContainerConfigLoader { return new DomainEventFactory(context.container.get(TYPES.Timer)) }) + container + .bind(TYPES.ItemTransferCalculator) + .toDynamicValue((context: interfaces.Context) => { + return new ItemTransferCalculator( + context.container.get(TYPES.ItemRepository), + context.container.get(TYPES.Logger), + ) + }) + return container } } diff --git a/packages/syncing-server/src/Bootstrap/ServerContainerConfigLoader.ts b/packages/syncing-server/src/Bootstrap/ServerContainerConfigLoader.ts index 098ccc6ab..eac851c16 100644 --- a/packages/syncing-server/src/Bootstrap/ServerContainerConfigLoader.ts +++ b/packages/syncing-server/src/Bootstrap/ServerContainerConfigLoader.ts @@ -23,8 +23,6 @@ import { ContentTypeFilter } from '../Domain/Item/SaveRule/ContentTypeFilter' import { ContentFilter } from '../Domain/Item/SaveRule/ContentFilter' import { CheckIntegrity } from '../Domain/UseCase/CheckIntegrity/CheckIntegrity' import { GetItem } from '../Domain/UseCase/GetItem/GetItem' -import { ItemTransferCalculatorInterface } from '../Domain/Item/ItemTransferCalculatorInterface' -import { ItemTransferCalculator } from '../Domain/Item/ItemTransferCalculator' import { ProjectorInterface } from '../Projection/ProjectorInterface' import { SavedItemProjection } from '../Projection/SavedItemProjection' import { SavedItemProjector } from '../Projection/SavedItemProjector' @@ -104,14 +102,6 @@ export class ServerContainerConfigLoader extends CommonContainerConfigLoader { context.container.get(TYPES.Logger), ) }) - container - .bind(TYPES.ItemTransferCalculator) - .toDynamicValue((context: interfaces.Context) => { - return new ItemTransferCalculator( - context.container.get(TYPES.ItemRepository), - context.container.get(TYPES.Logger), - ) - }) container .bind(TYPES.SyncResponseFactory20161215) .toDynamicValue((context: interfaces.Context) => { diff --git a/packages/syncing-server/src/Bootstrap/Types.ts b/packages/syncing-server/src/Bootstrap/Types.ts index 27d7bd070..4e92aee1d 100644 --- a/packages/syncing-server/src/Bootstrap/Types.ts +++ b/packages/syncing-server/src/Bootstrap/Types.ts @@ -43,7 +43,6 @@ const TYPES = { DuplicateItemSyncedEventHandler: Symbol.for('DuplicateItemSyncedEventHandler'), EmailBackupRequestedEventHandler: Symbol.for('EmailBackupRequestedEventHandler'), CloudBackupRequestedEventHandler: Symbol.for('CloudBackupRequestedEventHandler'), - UserContentSizeRecalculationRequestedEventHandler: Symbol.for('UserContentSizeRecalculationRequestedEventHandler'), ItemRevisionCreationRequestedEventHandler: Symbol.for('ItemRevisionCreationRequestedEventHandler'), // Services ContentDecoder: Symbol.for('ContentDecoder'), diff --git a/packages/syncing-server/src/Bootstrap/WorkerContainerConfigLoader.ts b/packages/syncing-server/src/Bootstrap/WorkerContainerConfigLoader.ts index 4cac66fab..e0adef635 100644 --- a/packages/syncing-server/src/Bootstrap/WorkerContainerConfigLoader.ts +++ b/packages/syncing-server/src/Bootstrap/WorkerContainerConfigLoader.ts @@ -195,10 +195,6 @@ export class WorkerContainerConfigLoader extends CommonContainerConfigLoader { ['ACCOUNT_DELETION_REQUESTED', context.container.get(TYPES.AccountDeletionRequestedEventHandler)], ['EMAIL_BACKUP_REQUESTED', context.container.get(TYPES.EmailBackupRequestedEventHandler)], ['CLOUD_BACKUP_REQUESTED', context.container.get(TYPES.CloudBackupRequestedEventHandler)], - [ - 'USER_CONTENT_SIZE_RECALCULATION_REQUESTED', - context.container.get(TYPES.UserContentSizeRecalculationRequestedEventHandler), - ], ['ITEM_REVISION_CREATION_REQUESTED', context.container.get(TYPES.ItemRevisionCreationRequestedEventHandler)], ])