feat(trackers): merge trackers info

This commit is contained in:
Alexey Kasyanchuk
2018-08-15 10:24:42 +03:00
parent 317cfdd3fb
commit 17371bd8ff
3 changed files with 36 additions and 4 deletions

View File

@ -116,7 +116,15 @@ module.exports = function (send, recive, dataDirectory, version, env)
return
logT('tracker', 'found', name, 'on', tracker)
this.sphinx.replaceValues('torrents', {hash, info: data}, true, 'hash')
this.sphinx.replaceValues('torrents', {hash, info: data}, {particial: true, key: 'hash', merge: ['info'], mergeCallback: (n, obj) => {
if(n != 'info')
return
if(!obj.trackers)
obj.trackers = []
obj.trackers.push(name)
obj.trackers = [...new Set(obj.trackers)]
} })
})
}
}