monitorrent icon indicating copy to clipboard operation
monitorrent copied to clipboard

Qbittorrent add torrent fixes (wait for async add)

Open LinFor opened this issue 5 years ago • 2 comments

В api qbittorrent процесс добавления нового торрента асинхронный - операция torrents_add завершается раньше, нежели добавленный торрент становится виден через интерфейс и api torrents_info. Интерфейс плагинов monitorrent, судя по всему, рассчитывает на синхронное завершение операции add_torrent.

В PR добавлена синхронизация: внутри add_torrent после добавления осуществляется поллинг torrents_info до тех пор, пока вновь добавленный торрент не появится, но не более, чем 30 раз с интервалом в 1 секунду.

Исправляет: #350

PS: Если что не так по стилю и т.д. - правьте сразу, я не умею в питон, не знаю как там принято писать и т.д.

LinFor avatar Mar 22 '21 16:03 LinFor

Coverage Status

Coverage decreased (-0.1%) to 99.376% when pulling f17f5d023c293cb8dda8f742c69bfc8e4e5c220b on LinFor:pr_qbittorrent into 871dbacf1f668c52bd3f395127d2ba4d5cf5c399 on werwolfby:develop.

coveralls avatar Mar 22 '21 16:03 coveralls

PRе уже почти год 😢 . Надо таки проревьювать и вкатить. И спасибо за фикс! Мне очень стыдно, что я так и не добрался.

werwolfby avatar Mar 17 '22 07:03 werwolfby

Codecov Report

Merging #354 (f17f5d0) into release/1.3.0 (5c38f82) will decrease coverage by 0.09%. The diff coverage is 80.64%.

:exclamation: Current head f17f5d0 differs from pull request most recent head fa79096. Consider uploading reports for the commit fa79096 to get more accurate results

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@                Coverage Diff                @@
##           release/1.3.0     #354      +/-   ##
=================================================
- Coverage          99.49%   99.40%   -0.09%     
=================================================
  Files                 56       56              
  Lines               4709     4719      +10     
=================================================
+ Hits                4685     4691       +6     
- Misses                24       28       +4     
Impacted Files Coverage Δ
monitorrent/plugins/trackers/__init__.py 98.64% <0.00%> (ø)
monitorrent/plugins/clients/qbittorrent.py 95.90% <83.33%> (-4.10%) :arrow_down:

... and 1 file with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov-commenter avatar Apr 02 '23 08:04 codecov-commenter

Я как-то не уверен, что ретрай с поиском торрента в клиенте так уже нам нужен, тем более на 30 попыток. Но я оставил для надежности. Но уменьшил до 10 попыток. И заменил while True: на for i in range(0, 10): уменьшев на несколько строк этот кусок с повторением.

werwolfby avatar Apr 02 '23 08:04 werwolfby