Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(LSG): get rid of async in handlers; extract shared logic to base classes #1367

Open
wants to merge 1 commit into
base: release53
Choose a base branch
from

Conversation

ianshade
Copy link
Contributor

@ianshade ianshade commented Jan 28, 2025

About the Contributor

This pull request is posted on behalf of TV 2 Norge

Type of Contribution

This is a:

Code improvement

Current Behavior

New Behavior

  • Event handlers for document updates are no longer asynchronous, which should make the code less prone to race conditions
  • Throttling (batching) of document update events is moved to the CollectionBase class
  • Repeating collection (publication) subscription and observer setup/teardown logic is extracted to the PublicationCollection class
  • Subscription to collection handlers by other collection handlers and topics is now performed in the init methods of those handlers and topics instead of all happening in LiveStatusServer
  • Large update methods are broken down into smaller ones, per each collection (tradeoff: a little extra boilerplate, but less indentation and better type safety)
  • Subscription to collection handlers is done more selectively - only change of selected properties trigger update events
  • Some redundant properties are removed (observerName)
  • In a few cases, slight changes of which collection handlers are subscribed to in order to get certain information (rundownId)
  • Simplified the initial no-data flow and empty array handling

Testing

  • I have added one or more unit tests for this PR
  • I have updated the relevant unit tests
  • No unit test changes are needed for this PR

Affected areas

This PR affects the Live Status Gateway

Time Frame

Not urgent, but it would be nice to have in release 52

Other Information

These changes were so far tested only on release50, with release51 LSG

Status

  • PR is ready to be reviewed.
  • The functionality has been tested by the author.
  • Relevant unit tests has been added / updated.
  • Relevant documentation (code comments, system documentation) has been added / updated.

@ianshade ianshade requested a review from a team as a code owner January 28, 2025 00:42
Copy link

codecov bot commented Jan 28, 2025

Codecov Report

Attention: Patch coverage is 53.27103% with 150 lines in your changes missing coverage. Please review.

Project coverage is 56.79%. Comparing base (054dcb1) to head (3252531).
Report is 13 commits behind head on release52.

Files with missing lines Patch % Lines
packages/live-status-gateway/src/wsHandler.ts 14.14% 71 Missing and 14 partials ⚠️
...ckages/live-status-gateway/src/helpers/equality.ts 6.81% 39 Missing and 2 partials ⚠️
...ages/live-status-gateway/src/topics/adLibsTopic.ts 75.00% 14 Missing ⚠️
...e-status-gateway/src/topics/activePlaylistTopic.ts 84.21% 8 Missing and 1 partial ⚠️
...es/live-status-gateway/src/topics/segmentsTopic.ts 96.42% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##           release52    #1367      +/-   ##
=============================================
+ Coverage      56.48%   56.79%   +0.30%     
=============================================
  Files            401      391      -10     
  Lines          72257    71672     -585     
  Branches        4170     4391     +221     
=============================================
- Hits           40816    40706     -110     
+ Misses         31204    30799     -405     
+ Partials         237      167      -70     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ianshade ianshade changed the title refactor(EAV-450): get rid of async in handlers; extract shared logic to base classes refactor(LSG): get rid of async in handlers; extract shared logic to base classes Jan 28, 2025
@nytamin nytamin added Contribution External contribution Contribution from TV 2 Norge Contributions sponsored by TV 2 Norge (tv2.no) labels Jan 29, 2025
@nytamin nytamin changed the base branch from release52 to release53 February 4, 2025 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Contribution from TV 2 Norge Contributions sponsored by TV 2 Norge (tv2.no) Contribution External contribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants