l3uddz / cloudplow

Automatic rclone remote uploader, with support for multiple remote/folder pairings. UnionFS Cleaner functionality: Deletion of UnionFS whiteout files and their corresponding files on rclone remotes. Automatic remote syncer: Sync between different remotes via a Scaleway server instance, that is created and destroyed at every sync.
GNU General Public License v3.0
338 stars 48 forks source link

Plex throttling doesn’t stop when streams stop #108

Closed Akury83 closed 2 years ago

Akury83 commented 2 years ago

Describe the bug When doing a cloudplow upload operation, the uploads throttle when streams are playing, however if a stream or all the streams stop, the throttling doesn’t end.

To Reproduce Steps to reproduce the behavior:

  1. Start cloudplow upload
  2. Plex stream starts playing
  3. Throttling begins
  4. Plex stream stops playing, or pauses
  5. Throttling does not end and remains

Expected behavior The throttle should be lifted

Screenshots N/a

Logs Link to debug or trace log files.

You can enable debug mode by adding --loglevel=DEBUG to the run command (e.g. systemd).

System Information

Additional context I only have evidence of the throttling failing to lift with one stream, I was never game enough to try an upload operation with two streams playing. I have noted that it happens whether the upload operation was manually initiated or automatically initiated

saltydk commented 2 years ago

Reopen this once you provide logs and the redacted config file. I pretty much just took over this project so need more information to go on here.

Akury83 commented 2 years ago

Apologies for not updating sooner, this can actually be fixed by changing the max_streams_before_throttle parameter in the config.json from the default value of 1 to 0, which means it will throttle according to the playing Plex streams all the time, as opposed >=1.

With the max_streams_before_throttle parameter set to the default value of 1, the debug level logging shows the following:

2022-02-22 10:06:59,060 - DEBUG - plex - get_streams - Server responded with status_code=200, content: b'{"MediaContainer":{"size":0}}' 2022-02-22 10:06:59,061 - DEBUG - plex - getstreams - There were no streams to check for server at 'https://(redacted)_'

and doesn't action the throttle back to the level 0 setting in the config.json file:

    "rclone": {
        "throttle_speeds": {
            "0": "1000M",
            "1": "50M",
            "2": "40M",
            "3": "30M",
            "4": "20M",
            "5": "10M"
        },

Hope this helps anyone experiencing the same issue.

saltydk commented 2 years ago

So the issue is what? The readme needs to be clearer or we need to tweak the default config? To me this seems pretty clear but happy to tweak it if it wasn't for you at the time.

Akury83 commented 2 years ago

Sorry for the delay in getting back to you. Yes, I believe that the following config parameter:

"max_streams_before_throttle": 1,

should be set to:

"max_streams_before_throttle": 0,

as default.

Also, in the readme, at this item under the Plex heading:

max_streams_before_throttle - How many playing streams are allowed before enabling throttling.

include a warning, as an example:

max_streams_before_throttle - How many playing streams are allowed before enabling throttling. Please note that increasing the threshold to anything above 0 will not lower the throttle below your set number of streams. Ie if you have this number set to 2, and the number of playing streams changes from 2 to <2, the throttle level will stay at the level set for 2 streams playing until the upload is finished.

saltydk commented 2 years ago

Could you try using develop and set it back to 1? The ideal is to fix this :)

saltydk commented 2 years ago

For context, are any of the streams used here local? Cloudplow seems to be filtering those out.

Would also appreciate a log of when it happens in your test of develop. Should help narrow it down.

Akury83 commented 2 years ago

None of the streams are local, all are remote. I’ll try to do this using develop on the weekend as asked and see how we go.