Skip to content
Snippets Groups Projects
Commit 66f5343f authored by Cédric Moreau's avatar Cédric Moreau
Browse files

Fix #502 Too much logs during command `sync` for peers

parent a819c263
Branches
Tags
No related merge requests found
...@@ -56,7 +56,7 @@ module.exports = function(server, interfaces, httpLogs) { ...@@ -56,7 +56,7 @@ module.exports = function(server, interfaces, httpLogs) {
httpMethods.httpGET( '/blockchain/with/tx', blockchain.with.tx, dtos.Stat, limiter.limitAsHighUsage()); httpMethods.httpGET( '/blockchain/with/tx', blockchain.with.tx, dtos.Stat, limiter.limitAsHighUsage());
httpMethods.httpGET( '/blockchain/branches', blockchain.branches, dtos.Branches, limiter.limitAsHighUsage()); httpMethods.httpGET( '/blockchain/branches', blockchain.branches, dtos.Branches, limiter.limitAsHighUsage());
httpMethods.httpGET( '/network/peering', net.peer, dtos.Peer, limiter.limitAsHighUsage()); httpMethods.httpGET( '/network/peering', net.peer, dtos.Peer, limiter.limitAsHighUsage());
httpMethods.httpGET( '/network/peering/peers', net.peersGet, dtos.MerkleOfPeers, limiter.limitAsHighUsage()); httpMethods.httpGET( '/network/peering/peers', net.peersGet, dtos.MerkleOfPeers, limiter.limitAsVeryHighUsage());
httpMethods.httpPOST( '/network/peering/peers', net.peersPost, dtos.Peer, limiter.limitAsHighUsage()); httpMethods.httpPOST( '/network/peering/peers', net.peersPost, dtos.Peer, limiter.limitAsHighUsage());
httpMethods.httpGET( '/network/peers', net.peers, dtos.Peers, limiter.limitAsHighUsage()); httpMethods.httpGET( '/network/peers', net.peers, dtos.Peers, limiter.limitAsHighUsage());
httpMethods.httpPOST( '/wot/add', wot.add, dtos.Identity, limiter.limitAsHighUsage()); httpMethods.httpPOST( '/wot/add', wot.add, dtos.Identity, limiter.limitAsHighUsage());
......
...@@ -219,7 +219,6 @@ function Synchroniser (server, host, port, conf, interactive) { ...@@ -219,7 +219,6 @@ function Synchroniser (server, host, port, conf, interactive) {
}); });
entry.signature = sign; entry.signature = sign;
watcher.writeStatus('Peer ' + entry.pubkey); watcher.writeStatus('Peer ' + entry.pubkey);
logger.info('Peer ' + entry.pubkey);
yield PeeringService.submitP(entry, false, to === undefined); yield PeeringService.submitP(entry, false, to === undefined);
} }
} }
......
...@@ -55,6 +55,10 @@ let HIGH_USAGE_STRATEGY = Object.create(Limiter); ...@@ -55,6 +55,10 @@ let HIGH_USAGE_STRATEGY = Object.create(Limiter);
HIGH_USAGE_STRATEGY.limitPerSecond = 10; HIGH_USAGE_STRATEGY.limitPerSecond = 10;
HIGH_USAGE_STRATEGY.limitPerMinute = 300; HIGH_USAGE_STRATEGY.limitPerMinute = 300;
let VERY_HIGH_USAGE_STRATEGY = Object.create(Limiter);
VERY_HIGH_USAGE_STRATEGY.limitPerSecond = 30;
VERY_HIGH_USAGE_STRATEGY.limitPerMinute = 30 * 60; // Limit is only per second
let TEST_STRATEGY = Object.create(Limiter); let TEST_STRATEGY = Object.create(Limiter);
TEST_STRATEGY.limitPerSecond = 5; TEST_STRATEGY.limitPerSecond = 5;
TEST_STRATEGY.limitPerMinute = 6; TEST_STRATEGY.limitPerMinute = 6;
...@@ -71,6 +75,10 @@ module.exports = { ...@@ -71,6 +75,10 @@ module.exports = {
return disableLimits ? createObject(NO_LIMIT_STRATEGY) : createObject(HIGH_USAGE_STRATEGY); return disableLimits ? createObject(NO_LIMIT_STRATEGY) : createObject(HIGH_USAGE_STRATEGY);
}, },
limitAsVeryHighUsage() {
return disableLimits ? createObject(NO_LIMIT_STRATEGY) : createObject(VERY_HIGH_USAGE_STRATEGY);
},
limitAsUnlimited() { limitAsUnlimited() {
return createObject(NO_LIMIT_STRATEGY); return createObject(NO_LIMIT_STRATEGY);
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment