server: torrentService: ensure active interval is applied

Fixes: aa0c7cf3db
This commit is contained in:
Jesse Chan
2020-10-24 01:14:20 +08:00
parent aa0c7cf3db
commit 5f47ddf153

View File

@@ -41,7 +41,10 @@ class TorrentService extends BaseService<TorrentServiceEvents> {
// starts polling when the first streaming listener is added
this.on('newListener', (event) => {
if (event === 'TORRENT_LIST_DIFF_CHANGE') {
this.pollInterval = config.torrentClientPollInterval;
if (this.pollInterval !== config.torrentClientPollInterval) {
this.pollInterval = config.torrentClientPollInterval;
this.deferFetchTorrentList();
}
}
});