@@ -1388,14 +1388,14 @@ private void OnPollClosed(PollClosedEventInternalDTO eventDto)
13881388 {
13891389 if ( ! _cache . Channels . TryGet ( eventDto . Cid , out var streamChannel ) )
13901390 {
1391+ #if STREAM_DEBUG_ENABLED
1392+ _logs . Warning ( $ "[{ nameof ( OnPollClosed ) } ] Poll WS event received but ignored because channel with ID { eventDto . Cid } was not found in cache") ;
1393+ #endif
13911394 return ;
13921395 }
13931396
1394- if ( ! _cache . Polls . TryGet ( eventDto . Poll . Id , out var streamPoll ) )
1395- {
1396- streamPoll = _cache . TryCreateOrUpdate ( eventDto . Poll ) ;
1397- streamPoll . InternalSetChannel ( streamChannel ) ;
1398- }
1397+ var streamPoll = _cache . TryCreateOrUpdate ( eventDto . Poll ) ;
1398+ streamPoll . InternalSetChannel ( streamChannel ) ;
13991399
14001400 streamPoll . HandlePollClosedEvent ( eventDto ) ;
14011401 }
@@ -1404,6 +1404,9 @@ private void OnPollDeleted(PollDeletedEventInternalDTO eventDto)
14041404 {
14051405 if ( ! _cache . Channels . TryGet ( eventDto . Cid , out var streamChannel ) )
14061406 {
1407+ #if STREAM_DEBUG_ENABLED
1408+ _logs . Warning ( $ "[{ nameof ( OnPollDeleted ) } ] Poll WS event received but ignored because channel with ID { eventDto . Cid } was not found in cache") ;
1409+ #endif
14071410 return ;
14081411 }
14091412
@@ -1418,14 +1421,14 @@ private void OnPollUpdated(PollUpdatedEventInternalDTO eventDto)
14181421 {
14191422 if ( ! _cache . Channels . TryGet ( eventDto . Cid , out var streamChannel ) )
14201423 {
1424+ #if STREAM_DEBUG_ENABLED
1425+ _logs . Warning ( $ "[{ nameof ( OnPollUpdated ) } ] Poll WS event received but ignored because channel with ID { eventDto . Cid } was not found in cache") ;
1426+ #endif
14211427 return ;
14221428 }
14231429
1424- if ( ! _cache . Polls . TryGet ( eventDto . Poll . Id , out var streamPoll ) )
1425- {
1426- streamPoll = _cache . TryCreateOrUpdate ( eventDto . Poll ) ;
1427- streamPoll . InternalSetChannel ( streamChannel ) ;
1428- }
1430+ var streamPoll = _cache . TryCreateOrUpdate ( eventDto . Poll ) ;
1431+ streamPoll . InternalSetChannel ( streamChannel ) ;
14291432
14301433 streamPoll . HandlePollUpdatedEvent ( eventDto ) ;
14311434 }
@@ -1434,14 +1437,14 @@ private void OnPollVoteCasted(PollVoteCastedEventInternalDTO eventDto)
14341437 {
14351438 if ( ! _cache . Channels . TryGet ( eventDto . Cid , out var streamChannel ) )
14361439 {
1440+ #if STREAM_DEBUG_ENABLED
1441+ _logs . Warning ( $ "[{ nameof ( OnPollVoteCasted ) } ] Poll WS event received but ignored because channel with ID { eventDto . Cid } was not found in cache") ;
1442+ #endif
14371443 return ;
14381444 }
14391445
1440- if ( ! _cache . Polls . TryGet ( eventDto . Poll . Id , out var streamPoll ) )
1441- {
1442- streamPoll = _cache . TryCreateOrUpdate ( eventDto . Poll ) ;
1443- streamPoll . InternalSetChannel ( streamChannel ) ;
1444- }
1446+ var streamPoll = _cache . TryCreateOrUpdate ( eventDto . Poll ) ;
1447+ streamPoll . InternalSetChannel ( streamChannel ) ;
14451448
14461449 streamPoll . HandlePollVoteCastedEvent ( eventDto ) ;
14471450 }
@@ -1450,14 +1453,14 @@ private void OnPollVoteChanged(PollVoteChangedEventInternalDTO eventDto)
14501453 {
14511454 if ( ! _cache . Channels . TryGet ( eventDto . Cid , out var streamChannel ) )
14521455 {
1456+ #if STREAM_DEBUG_ENABLED
1457+ _logs . Warning ( $ "[{ nameof ( OnPollVoteChanged ) } ] Poll WS event received but ignored because channel with ID { eventDto . Cid } was not found in cache") ;
1458+ #endif
14531459 return ;
14541460 }
14551461
1456- if ( ! _cache . Polls . TryGet ( eventDto . Poll . Id , out var streamPoll ) )
1457- {
1458- streamPoll = _cache . TryCreateOrUpdate ( eventDto . Poll ) ;
1459- streamPoll . InternalSetChannel ( streamChannel ) ;
1460- }
1462+ var streamPoll = _cache . TryCreateOrUpdate ( eventDto . Poll ) ;
1463+ streamPoll . InternalSetChannel ( streamChannel ) ;
14611464
14621465 streamPoll . HandlePollVoteChangedEvent ( eventDto ) ;
14631466 }
@@ -1466,14 +1469,14 @@ private void OnPollVoteRemoved(PollVoteRemovedEventInternalDTO eventDto)
14661469 {
14671470 if ( ! _cache . Channels . TryGet ( eventDto . Cid , out var streamChannel ) )
14681471 {
1472+ #if STREAM_DEBUG_ENABLED
1473+ _logs . Warning ( $ "[{ nameof ( OnPollVoteRemoved ) } ] Poll WS event received but ignored because channel with ID { eventDto . Cid } was not found in cache") ;
1474+ #endif
14691475 return ;
14701476 }
14711477
1472- if ( ! _cache . Polls . TryGet ( eventDto . Poll . Id , out var streamPoll ) )
1473- {
1474- streamPoll = _cache . TryCreateOrUpdate ( eventDto . Poll ) ;
1475- streamPoll . InternalSetChannel ( streamChannel ) ;
1476- }
1478+ var streamPoll = _cache . TryCreateOrUpdate ( eventDto . Poll ) ;
1479+ streamPoll . InternalSetChannel ( streamChannel ) ;
14771480
14781481 streamPoll . HandlePollVoteRemovedEvent ( eventDto ) ;
14791482 }
0 commit comments