SSH servers seem to have a maximum number of opened channels, after
which paramiko will raise an exception:
Could not open an SSH channel: ChannelException(2, 'Connect failed')
Memoizing the SFTPClient object based on the timeout setting leads to
many opened sessions, since the timeout is typically adjusted, e.g. to
match the size of the file when pulling an ftrace trace.dat file.
Solve that by memoizing the SFTPClient based only on the connection
object, with a maximum number of 1 cached object, and update its timeout
setting inplace.
SSH servers seem to have a maximum number of opened channels, after which paramiko will raise an exception:
Memoizing the SFTPClient object based on the timeout setting leads to many opened sessions, since the timeout is typically adjusted, e.g. to match the size of the file when pulling an ftrace trace.dat file.
Solve that by memoizing the SFTPClient based only on the connection object, with a maximum number of 1 cached object, and update its timeout setting inplace.