Skip to content

Commit

Permalink
add more log messages and bump v
Browse files Browse the repository at this point in the history
  • Loading branch information
dskvr committed Mar 9, 2023
1 parent 481ea3c commit 6943ba3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nostrwatch-js",
"version": "0.0.41",
"version": "0.0.42",
"description": "js library for aggregating data from and checking the status of nostr relays",
"main": "index.js",
"type": "module",
Expand Down
14 changes: 10 additions & 4 deletions src/checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,12 @@ RelayChecker.prototype.check_write = function() {
this.opts.checkSpamMitigation = true
this.result.check.write = null
this.opts.checkWrite = false
this.log('info', `Skipped write check for paid relay.`)
this.log('info', `Skipped write check (only checked for public relays)`)
this.relay.subscribe(subid, {limit: 1, kinds:[1], ids:[this.testEvent.id]})
this.update_state(`testing spam protection`)
}
else {
this.log('info', `Skipped spam mitigation check (only checked for paid relays for now)`)
this.update_state(`testing write capabilities`)
}

Expand Down Expand Up @@ -329,10 +330,15 @@ RelayChecker.prototype.handle_event = function(subid, event) {
if(!type.includes('latency')){
this.result.check[type] = true
this.result.latency[type] = Date.now() - this.result.latency.begin[type]
if(type === 'write')
this.log('success', `handled event from ${type} check in ${this.result.latency[type]}ms (test event.id: ${this.testEvent.id})`)
else
if(type === 'write'){
if(this.payment_required())
this.log('error', `paid relay failed to block spam note (test event.id: ${this.testEvent.id})`)
else
this.log('success', `handled event from ${type} check in ${this.result.latency[type]}ms (test event.id: ${this.testEvent.id})`)
}
else {
this.log('success', `handled event from ${type} check in ${this.result.latency[type]}ms`)
}
}
else {
this.handle_read_latencies()
Expand Down

0 comments on commit 6943ba3

Please sign in to comment.