-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(communities)_: delay starting torrent client until connection is established #5125
Conversation
8c4682f
to
76538ee
Compare
Jenkins BuildsClick to see older builds (12)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a minor question
err := m.StartTorrentClient() | ||
if err != nil { | ||
m.LogStdout("couldn't start torrent client", zap.Error(err)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also stop the client if !online
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @0x-r4bbit,
yeah, I have thought about stopping the client when !online
. But I have 2 concerns:
-
StartTorrentClient
creates a new instance ofTorrentClient
. This means that any previous calls totorrentClient.AddTorrent
may be lost (e.g. it's called fromSeedHistoryArchiveTorrent
). And the same forAddMagnet
. Is it okay to rebuildtorrentClient
without restoring torrents/magents?
To be on the safe side I only use thesetOnline
method to delay the creation of theTorrentClient
. -
There is also an api call
EnableCommunityHistoryArchiveProtocol (and Disable)
that starts/stops thetorrentClient
(which could currently be called from the Desktop Settings). And I thought that the behaviour ofsetOnline
andEnableCommunityHistoryArchiveProtocol
might be inconsistent.
Maybe I'm missing other problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is also an api call EnableCommunityHistoryArchiveProtocol (and Disable) that starts/stops the torrentClient (which could currently be called from the Desktop Settings). And I thought that the behaviour of setOnline and EnableCommunityHistoryArchiveProtocol might be inconsistent.
Yes, as a matter of fact, back then, it was a requirement for the torrent to always be bootstrapped when using desktop clients. The setting to enable/disable the protocol was more of a thing for development (this might have changed by now).
Considering that, it indeed makes sense to keep the client running once it has started (unless the protocol is disabled entirely).
The reason I brought this up here is because I thought, when !online
, the torrent client might cause high CPU usage again, but maybe that's not the case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, as a matter of fact, back then, it was a requirement for the torrent to always be bootstrapped when using desktop clients. The setting to enable/disable the protocol was more of a thing for development (this might have changed by now).
Considering that, it indeed makes sense to keep the client running once it has started (unless the protocol is disabled entirely).
I see, thank you for clarifying that.
The reason I brought this up here is because I thought, when !online, the torrent client might cause high CPU usage again, but maybe that's not the case?
Yes, the torrent client only uses a lot of CPU when it's started while offline.
Here I'm enabling and disabling the network, but the CPU usage remains low:
torrent_goes_offline.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
76538ee
to
7a16a96
Compare
…established Fixes # 14510
7a16a96
to
5a76c98
Compare
Messenger
is subscribed to connectivity status updates. Whenever status is updated,Messenger
callsManager.setOnline
Manager
launches TorrentClient on first connectionCloses status-im/status-desktop#14510