webtorrent / webtorrent

⚡️ Streaming torrent client for the web

Home Page:https://webtorrent.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

no reasonable clean way to get a timeout on add

uriva opened this issue · comments

a common use case is that someone is calling add on a torrent with not many seeders.

then the callback might never be returned.

the usual approach which is wrapping it in a promise, and using Promise.race with a timeout can work, but then the torrent will get added and start downloading eventually, and there would be no easy way to know this happened or clean it up.