Skip to content

[fix] transmission: allow from_task with multiple servers#3353

Closed
soloam wants to merge 4 commits intoFlexget:developfrom
soloam:transmission_from_task
Closed

[fix] transmission: allow from_task with multiple servers#3353
soloam wants to merge 4 commits intoFlexget:developfrom
soloam:transmission_from_task

Conversation

@soloam
Copy link
Copy Markdown
Contributor

@soloam soloam commented Feb 7, 2022

Motivation for changes:

More that one instance of transmission was not possible to use in plugin from_task

Detailed changes:

  • Save and restore preview transmission instance

Addressed issues:

@gazpachoking
Copy link
Copy Markdown
Member

Hmm. This is why we don't like __init__s or storing things on self in the plugins. I wonder if there is a better way... Perhaps it gets stored on task? task._transmission_client = Whatever()?

@gazpachoking
Copy link
Copy Markdown
Member

I suppose both of these solutions break if you do something like:

inputs:
- from_transmission: hostA
- from_transmission: hostB

@gazpachoking
Copy link
Copy Markdown
Member

Why are we even storing client instance like this? Shouldn't it just be created and closed in task_input (for from_transmission) and task_output (for regular transmission?)

@soloam
Copy link
Copy Markdown
Contributor Author

soloam commented Feb 8, 2022

I think that the main reason is to reuse the same connection if you use input and output or download (or all of them) in the same task. But now that I see it, like this you can't input from one server and output from another!

I also don't like to do this in the task start. One better way would be to start in the stages, and stor it in the task, and on each starge check if the config is the same, and if yes refuse, if not connect again.

This also would solve the from A and from B, because it would compare the config and see that it's different, and disconnect and connect again

@soloam
Copy link
Copy Markdown
Contributor Author

soloam commented Feb 8, 2022

I tried to re-trigger the checks, but something seams wrong! Locally was ok.

I changed the code to get get the client connection on every stage and store it to latter check if can be reused or make a new connection.

return config

def create_rpc_client(self, config):
def create_rpc_client(self, config) -> transmissionrpc.Client:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def create_rpc_client(self, config) -> transmissionrpc.Client:
def create_rpc_client(self, config) -> 'transmissionrpc.Client':

This is probably the reason for the test failures.

@gazpachoking
Copy link
Copy Markdown
Member

Thanks for this! Went with #3359 instead, as it seemed a bit simpler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transmission cann't handle two clients when crossmatch

2 participants