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

Use non-persistent connection for MPD #94507

Merged

Commits on Jun 12, 2023

  1. Do not use a persistent connection to MPD

    In other words, don't rely on the connection management provided by
    "python-mpd2". Instead of keeping the connection to MPD open, we
    explicitly connect before and disconnect after each command.
    
    There is probably a bit of overhead to this, but as the integration
    uses a local-polling approach to begin with, no functionality is lost or
    degraded.
    
    This change greatly hardens the MPD integration against both network
    issues and problems with the daemon itself. All connection-related
    failure modes have effectively been removed.
    thijsputman committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    3400e3c View commit details
    Browse the repository at this point in the history
  2. Update state retrieval methods

    Only "async_get_media_image" attempts to connect, all others are either
    called from there, or from the main "async_update" method (see previous
    commit) which also attempts to connect.
    
    So, this commit mainly revolves around gracefully handling situations
    where no connection is available when trying to retrieve MPD state.
    
    Finally, note the removal of "self._commands". This property is only
    used at the start of "_async_get_file_image_response" and was thus
    changed into a local variable.
    thijsputman committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    bb1996f View commit details
    Browse the repository at this point in the history
  3. Update media-player control methods

    These all need to explicitly connect to MPD as part of their flow.
    thijsputman committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    1c2577c View commit details
    Browse the repository at this point in the history

Commits on Jun 13, 2023

  1. Configuration menu
    Copy the full SHA
    7a422c4 View commit details
    Browse the repository at this point in the history

Commits on Jun 16, 2023

  1. Configuration menu
    Copy the full SHA
    9d4a6df View commit details
    Browse the repository at this point in the history
  2. Minor changes

    thijsputman committed Jun 16, 2023
    Configuration menu
    Copy the full SHA
    5fbfe38 View commit details
    Browse the repository at this point in the history

Commits on Jul 10, 2023

  1. Configuration menu
    Copy the full SHA
    2e1b30c View commit details
    Browse the repository at this point in the history

Commits on Aug 15, 2023

  1. Configuration menu
    Copy the full SHA
    4683ac4 View commit details
    Browse the repository at this point in the history

Commits on Aug 17, 2023

  1. Configuration menu
    Copy the full SHA
    3877241 View commit details
    Browse the repository at this point in the history

Commits on Aug 24, 2023

  1. Configuration menu
    Copy the full SHA
    47c46a0 View commit details
    Browse the repository at this point in the history
  2. Initialise "self._status" to empty dictionary

    Used to be initialised as None, which caused "NoneType is not iterable"
    type of issues in case of an unexpected disconnect (at which point
    status gets set to None again). Instead of guarding against None
    everywhere, using an empty dictionary seemed more prudent...
    
    Furthermore, more cautiously access its members to prevent potential
    KeyError-s in similar cases.
    thijsputman committed Aug 24, 2023
    Configuration menu
    Copy the full SHA
    1343e33 View commit details
    Browse the repository at this point in the history
  3. Fix livelock in "async_mute_volume()"

    This method doesn't need a connection; it calls into two other methods
    that actually connect to MPD – attempting to connect from here resulted
    in a livelock.
    thijsputman committed Aug 24, 2023
    Configuration menu
    Copy the full SHA
    3901e92 View commit details
    Browse the repository at this point in the history