Skip to content

Commit

Permalink
use of a more appropriate compilation flag name
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivansete-status committed May 29, 2024
1 parent c9879a8 commit a851cc9
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ ifeq ($(POSTGRES), 1)
NIM_PARAMS := $(NIM_PARAMS) -d:postgres -d:nimDebugDlOpen
endif

ifeq ($(LOG_HASH), 1)
NIM_PARAMS := $(NIM_PARAMS) -d:log_msg_hash
ifeq ($(LOG_MSG_HASHES), 1)
NIM_PARAMS := $(NIM_PARAMS) -d:logMessageHashes
endif

clean: | clean-libbacktrace
Expand Down
10 changes: 5 additions & 5 deletions waku/node/waku_node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ proc registerRelayDefaultHandler(node: WakuNode, topic: PubsubTopic) =
return

proc traceHandler(topic: PubsubTopic, msg: WakuMessage) {.async, gcsafe.} =
when defined(log_msg_hash):
when defined(logMessageHashes):
info "waku.relay received",
my_peer_id = node.peerId,
pubsubTopic = topic,
Expand Down Expand Up @@ -357,7 +357,7 @@ proc publish*(
#TODO instead of discard return error when 0 peers received the message
discard await node.wakuRelay.publish(pubsubTopic, message)

when defined(log_msg_hash):
when defined(logMessageHashes):
info "waku.relay published",
peerId = node.peerId,
pubsubTopic = pubsubTopic,
Expand Down Expand Up @@ -953,7 +953,7 @@ proc mountLightPush*(

if publishedCount == 0:
## Agreed change expected to the lightpush protocol to better handle such case. https://github.com/waku-org/pm/issues/93
when defined(log_msg_hash):
when defined(logMessageHashes):
let msgHash = computeMessageHash(pubsubTopic, message).to0xHex()
info "Lightpush request has not been published to any peers",
msg_hash = msgHash
Expand Down Expand Up @@ -997,7 +997,7 @@ proc lightpushPublish*(
): Future[WakuLightPushResult[void]] {.async, gcsafe.} =
let msgHash = pubsubTopic.computeMessageHash(message).to0xHex()
if not node.wakuLightpushClient.isNil():
when defined(log_msg_hash):
when defined(logMessageHashes):
info "publishing message with lightpush",
pubsubTopic = pubsubTopic,
contentTopic = message.contentTopic,
Expand All @@ -1006,7 +1006,7 @@ proc lightpushPublish*(
return await node.wakuLightpushClient.publish(pubsubTopic, message, peer)

if not node.wakuLightPush.isNil():
when defined(log_msg_hash):
when defined(logMessageHashes):
info "publishing message with self hosted lightpush",
pubsubTopic = pubsubTopic,
contentTopic = message.contentTopic,
Expand Down
4 changes: 2 additions & 2 deletions waku/waku_archive/archive.nim
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ proc handleMessage*(
else:
getNanosecondTime(getTime().toUnixFloat())

when defined(log_msg_hash):
when defined(logMessageHashes):
info "archive handling message",
msg_hash = msgHashHex,
pubsubTopic = pubsubTopic,
Expand All @@ -118,7 +118,7 @@ proc handleMessage*(
waku_archive_errors.inc(labelValues = [insertFailure])
error "failed to insert message", error = error

when defined(log_msg_hash):
when defined(logMessageHashes):
info "message archived",
msg_hash = msgHashHex,
pubsubTopic = pubsubTopic,
Expand Down
8 changes: 4 additions & 4 deletions waku/waku_filter_v2/protocol.nim
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ proc pushToPeer(wf: WakuFilter, peer: PeerId, buffer: seq[byte]) {.async.} =
proc pushToPeers(
wf: WakuFilter, peers: seq[PeerId], messagePush: MessagePush
) {.async.} =
when defined(log_msg_hash):
when defined(logMessageHashes):
let targetPeerIds = peers.mapIt(shortLog(it))
let msgHash =
messagePush.pubsubTopic.computeMessageHash(messagePush.wakuMessage).to0xHex()
Expand Down Expand Up @@ -217,7 +217,7 @@ proc handleMessage*(
) {.async.} =
let msgHash = computeMessageHash(pubsubTopic, message).to0xHex()

when defined(log_msg_hash):
when defined(logMessageHashes):
info "handling message", pubsubTopic = pubsubTopic, msg_hash = msgHash

let handleMessageStartTime = Moment.now()
Expand All @@ -227,7 +227,7 @@ proc handleMessage*(
let subscribedPeers =
wf.subscriptions.findSubscribedPeers(pubsubTopic, message.contentTopic)
if subscribedPeers.len == 0:
when defined(log_msg_hash):
when defined(logMessageHashes):
info "no subscribed peers found",
pubsubTopic = pubsubTopic,
contentTopic = message.contentTopic,
Expand All @@ -247,7 +247,7 @@ proc handleMessage*(
target_peer_ids = subscribedPeers.mapIt(shortLog(it))
waku_filter_errors.inc(labelValues = [pushTimeoutFailure])
else:
when defined(log_msg_hash):
when defined(logMessageHashes):
info "pushed message succesfully to all subscribers",
pubsubTopic = pubsubTopic,
contentTopic = message.contentTopic,
Expand Down
2 changes: 1 addition & 1 deletion waku/waku_lightpush/protocol.nim
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ proc handleRequest*(
pubSubTopic = request.get().pubSubTopic
message = request.get().message
waku_lightpush_messages.inc(labelValues = ["PushRequest"])
when defined(log_msg_hash):
when defined(logMessageHashes):
info "lightpush request",
peer_id = peerId,
requestId = requestId,
Expand Down
2 changes: 1 addition & 1 deletion waku/waku_relay/protocol.nim
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ proc publish*(
): Future[int] {.async.} =
let data = message.encode().buffer

when defined(log_msg_hash):
when defined(logMessageHashes):
let msgHash = computeMessageHash(pubsubTopic, message).to0xHex()
info "start publish Waku message", msg_hash = msgHash, pubsubTopic = pubsubTopic

Expand Down

0 comments on commit a851cc9

Please sign in to comment.