fix(trackers): fix updating trackers on page open
This commit is contained in:
parent
1d76939e26
commit
34981c3609
@ -187,8 +187,8 @@ export default class TorrentPage extends Page {
|
||||
}
|
||||
//this.forceUpdate(); // вызывается через searchingIndicator
|
||||
|
||||
// Получаем более новую статистику пира
|
||||
if((new Date).getTime() - this.torrent.trackersChecked > 10 * 60 * 1000) {
|
||||
// Получаем более новую статистику пира
|
||||
if((Date.now() / 1000) - this.torrent.trackersChecked > 10 * 60) {
|
||||
window.torrentSocket.emit('checkTrackers', this.torrent.hash);
|
||||
}
|
||||
}
|
||||
@ -220,7 +220,7 @@ export default class TorrentPage extends Page {
|
||||
if(!this.torrent)
|
||||
return;
|
||||
|
||||
Object.assign(this.torrent, info);
|
||||
this.torrent = Object.assign(this.torrent, info);
|
||||
this.forceUpdate();
|
||||
}
|
||||
window.torrentSocket.on('trackerTorrentUpdate', this.trackerUpdate);
|
||||
@ -358,7 +358,7 @@ export default class TorrentPage extends Page {
|
||||
<TorrentInformation torrent={this.torrent} parent={this} />
|
||||
</div>
|
||||
<div style={{flexBasis: '40%'}} className='column center w100p'>
|
||||
<img src={NoImage} className='pad0-75' style={{height: '200px'}} />
|
||||
<img src={(this.torrent && this.torrent.info && this.torrent.info.poster) ? this.torrent.info.poster : NoImage} className='pad0-75' style={{height: '200px'}} />
|
||||
<RaisedButton
|
||||
href={`magnet:?xt=urn:btih:${this.torrent.hash}`}
|
||||
target="_self"
|
||||
@ -509,6 +509,15 @@ export default class TorrentPage extends Page {
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
{
|
||||
this.torrent && this.torrent.info && this.torrent.info.description
|
||||
?
|
||||
<div />
|
||||
:
|
||||
null
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</Tab>
|
||||
<Tab label={__('Files')} value="files" >
|
||||
|
@ -25,6 +25,7 @@ module.exports = async ({
|
||||
setupTorrentRecord,
|
||||
p2pStore,
|
||||
feed,
|
||||
updateTorrentTrackers,
|
||||
remoteTrackers
|
||||
}) => {
|
||||
let torrentClientHashMap = {}
|
||||
@ -515,7 +516,9 @@ module.exports = async ({
|
||||
if(hash.length != 40)
|
||||
return;
|
||||
|
||||
logT('tracker', 'recheck trackers for', hash)
|
||||
updateTorrentTrackers(hash);
|
||||
remoteTrackers.update({hash, name: hash})
|
||||
});
|
||||
|
||||
const topTorrentsCall = (type, navigation = {}, callback) => {
|
||||
|
@ -116,6 +116,7 @@ module.exports = function (send, recive, dataDirectory, version, env)
|
||||
return
|
||||
|
||||
logT('tracker', 'found', name, 'on', tracker)
|
||||
let info;
|
||||
this.sphinx.replaceValues('torrents', {hash, info: data}, {
|
||||
particial: true,
|
||||
key: 'hash',
|
||||
@ -129,7 +130,14 @@ module.exports = function (send, recive, dataDirectory, version, env)
|
||||
obj.trackers = []
|
||||
obj.trackers.push(tracker)
|
||||
obj.trackers = [...new Set(obj.trackers)]
|
||||
} })
|
||||
|
||||
info = obj
|
||||
} }).then(() => {
|
||||
send('trackerTorrentUpdate', {
|
||||
hash,
|
||||
info
|
||||
});
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -151,7 +159,7 @@ module.exports = function (send, recive, dataDirectory, version, env)
|
||||
seeders: row.seeders,
|
||||
completed: row.completed,
|
||||
leechers: row.leechers,
|
||||
trackersChecked: row.trackersChecked ? row.trackersChecked.getTime() : undefined,
|
||||
trackersChecked: row.trackerschecked || row.trackersChecked,
|
||||
good: row.good,
|
||||
bad: row.bad,
|
||||
info: typeof row.info == 'string' && row.info.length > 0 ? JSON.parse(row.info) : undefined
|
||||
@ -781,6 +789,7 @@ module.exports = function (send, recive, dataDirectory, version, env)
|
||||
setupTorrentRecord,
|
||||
p2pStore,
|
||||
feed,
|
||||
updateTorrentTrackers,
|
||||
remoteTrackers
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user