fix(syncing-server): add debug logs about sending items changed event

This commit is contained in:
Karol Sójko 2023-11-28 11:21:48 +01:00
parent d0d4bd23fb
commit 2d6a3ebf45
No known key found for this signature in database
GPG key ID: C2F813669419D05F
2 changed files with 4 additions and 0 deletions

View file

@ -81,6 +81,7 @@ describe('SaveItems', () => {
updateExistingItem.execute = jest.fn().mockResolvedValue(Result.ok(savedItem))
logger = {} as jest.Mocked<Logger>
logger.debug = jest.fn()
logger.error = jest.fn()
itemHash1 = ItemHash.create({

View file

@ -160,8 +160,11 @@ export class SaveItems implements UseCaseInterface<SaveItemsResult> {
const tenPercentSpreadArray = Array.from(Array(10).keys())
const diceRoll = this.deterministicSelector.select(dto.userUuid, tenPercentSpreadArray)
if (diceRoll !== 1) {
this.logger.debug(`[${dto.userUuid}] Not sending items changed event to client.`)
return
}
this.logger.debug(`[${dto.userUuid}] Sending items changed event to client.`)
const itemsChangedEvent = this.domainEventFactory.createItemsChangedOnServerEvent({
userUuid: dto.userUuid,