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

Only read queue when required #156

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

Conversation

cedricve
Copy link
Member

@cedricve cedricve commented Jan 20, 2025

Description

Pull Request Title: Only Read Queue When Required

Motivation and Improvement

The primary motivation behind this pull request is to optimize the handling of live stream data by only reading from the queue when it is necessary. This change addresses unnecessary queue reads and improves the performance and efficiency of the live stream processing. The specific improvements are as follows:

  1. Performance Optimization: By avoiding unnecessary reads from the queue when there are no active live stream requests, we reduce the computational overhead and improve the overall performance of the system.

  2. Resource Utilization: This change ensures that resources are utilized more efficiently by only processing data when there is an active request, which can lead to reduced CPU and memory usage.

  3. Code Cleanliness: The changes also include resetting the image object after processing, which helps in managing memory more effectively and prevents potential memory leaks.

Summary of Changes

  • Modified the HandleLiveStreamSD function to check the time since the last live stream request before reading from the queue.
  • Moved the call to livestreamCursor.ReadPacket() and subsequent packet validation inside the condition that checks for active live stream requests.
  • Added code to reset the image object after processing, ensuring memory is managed properly.
  • Included the import of the image package to facilitate the image reset functionality.

By implementing these changes, we ensure that the system is more responsive and efficient, leading to better performance and resource management.

@cedricve cedricve added the enhancement New feature or request label Jan 20, 2025
@cedricve cedricve self-assigned this Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant