remove 2nd param from Math.floor, refreshSendingSwarm fix refreshSwarmNodesForPubKey pubkey

pull/1061/head
Ryan Tharp 5 years ago
parent 078e95f8c9
commit 2be1a0850c

@ -138,9 +138,7 @@ class LokiMessageAPI {
} }
async refreshSendingSwarm(pubKey, timestamp) { async refreshSendingSwarm(pubKey, timestamp) {
const freshNodes = await lokiSnodeAPI.refreshSwarmNodesForPubKey( const freshNodes = await lokiSnodeAPI.refreshSwarmNodesForPubKey(pubKey);
this.ourKey
);
this.sendingData[timestamp].swarm = freshNodes; this.sendingData[timestamp].swarm = freshNodes;
this.sendingData[timestamp].hasFreshList = true; this.sendingData[timestamp].hasFreshList = true;
return true; return true;
@ -434,8 +432,11 @@ class LokiMessageAPI {
this.ourKey this.ourKey
); );
// ok now split up our swarm pool into numConnections number of pools
// one for each retrieve connection
// floor or ceil probably doesn't matter, since it's likely always uneven // floor or ceil probably doesn't matter, since it's likely always uneven
const poolSize = Math.floor(nodes.length / numConnections, 10); const poolSize = Math.floor(nodes.length / numConnections);
const pools = []; const pools = [];
while (nodes.length) { while (nodes.length) {
const poolList = nodes.splice(0, poolSize); const poolList = nodes.splice(0, poolSize);

Loading…
Cancel
Save