Mise à jour de GitLab prévue ce samedi 23 octobre 2021 à partir de 9h00 CET

Commit f7df3868 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[fix] #1144 Too many redundant logs

parent b96394de
......@@ -171,17 +171,15 @@ export class Multicaster extends stream.Transform {
try {
if(!params.withIsolation || !(this.conf && this.conf.isolate)) {
let theDoc = params.transform ? params.transform(doc) : doc;
logger.debug('--> new %s to be sent to %s peer(s)', params.type, peers.length);
if (params.getDocID) {
logger.info('POST %s %s', params.type, params.getDocID(theDoc));
logger.info('POST %s %s to %s peers', params.type, params.getDocID(theDoc), peers.length)
} else {
logger.info('POST %s', params.type);
logger.info('POST %s to %s peers', params.type, peers.length);
}
// Parallel treatment for superfast propagation
await Promise.all(peers.map(async (p) => {
let peer = PeerDTO.fromJSONObject(p)
const namedURL = peer.getNamedURL();
logger.debug(' `--> to peer %s [%s] (%s)', peer.keyID(), peer.member ? 'member' : '------', namedURL);
try {
await this.post(peer, params.uri, params.getObj(theDoc))
} catch (e) {
......@@ -190,7 +188,7 @@ export class Multicaster extends stream.Transform {
const json = JSON.parse(e.body);
await params.onError(json, doc, namedURL)
} catch (ex) {
logger.warn('Could not reach %s', namedURL);
logger.warn('Could not reach %s, reason: %s', namedURL, (ex && ex.message || ex))
}
}
}
......
......@@ -43,8 +43,12 @@ export abstract class AbstractController {
} catch (e) {
const event = CommonConstants.DocumentError
this.server.emit(event, e)
this.logger.error(e);
throw e;
if (e !== "Block already known" && (!e || !e.uerr || (
e.uerr.ucode !== CommonConstants.ERRORS.PEER_DOCUMENT_ALREADY_KNOWN.uerr.ucode
&& e.uerr.ucode !== CommonConstants.ERRORS.DOCUMENT_BEING_TREATED.uerr.ucode))) {
this.logger.error(e)
}
throw e
}
}
}
\ No newline at end of file
......@@ -243,7 +243,7 @@ function getResultingError(e:any, logger:any) {
let error = BMAConstants.ERRORS.UNKNOWN;
if (e) {
// Print eventual stack trace
typeof e == 'string' && logger && logger.error(e);
typeof e == 'string' && e !== "Block already known" && logger && logger.error(e);
e.stack && logger && logger.error(e.stack);
e.message && logger && logger.warn(e.message);
// BusinessException
......
......@@ -13,6 +13,7 @@ import {WS2P_REQ} from "../WS2PRequester"
import {WS2PCluster} from "../WS2PCluster"
import {WS2PConnection} from "../WS2PConnection"
import {WS2PConstants} from "../constants"
import {CommonConstants} from "../../../../lib/common-libs/constants"
export enum WS2P_REQERROR {
UNKNOWN_REQUEST
......@@ -101,7 +102,12 @@ export class WS2PServerMessageHandler implements WS2PMessageHandler {
delete this.errors[documentHash]
}, 1000 * WS2PConstants.ERROR_RECALL_DURATION_IN_SECONDS)
}
this.server.logger.warn(e)
if (e !== "Block already known"
&& (!e.uerr
|| !(e.uerr.ucode == CommonConstants.ERRORS.DOCUMENT_BEING_TREATED.uerr.ucode
|| e.uerr.ucode == CommonConstants.ERRORS.PEER_DOCUMENT_ALREADY_KNOWN.uerr.ucode))) {
this.server.logger.warn(e)
}
}
}
......
......@@ -71,7 +71,6 @@ export class PeeringService {
};
submitP(peering:DBPeer, eraseIfAlreadyRecorded = false, cautious = true): Promise<PeerDTO> {
this.logger.info('⬇ PEER %s', peering.pubkey.substr(0, 8))
// Force usage of local currency name, do not accept other currencies documents
peering.currency = this.conf.currency || peering.currency;
let thePeerDTO = PeerDTO.fromJSONObject(peering)
......@@ -164,7 +163,6 @@ export class PeeringService {
}
return PeerDTO.fromDBPeer(savedPeer)
} catch (e) {
this.logger.info('✘ PEER %s', peering.pubkey.substr(0, 8))
throw e
}
})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment