Skip to content

Commit

Permalink
fix version mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
dskvr committed Jul 22, 2024
1 parent f2dfff1 commit df72ab0
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 77 deletions.
75 changes: 33 additions & 42 deletions apps/nocapd/src/classes/Worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,39 @@ import nocapAdapters from "@nostrwatch/nocap-every-adapter-default"


export class NWWorker {

$
rcache
pubkey
cb = {}
processed = 1
total = 0
relayMeta = new Map()
cache_counts = {}
jobs = {}
hard_stop = false

nocapOpts = {
timeout: this.timeout,
checked_by: this.pubkey
}

jobOpts = {
removeOnComplete: false,
removeOnFail: {
age: timestring('10m', 's')
}
}

timeout = {
open: 3000,
read: 3000,
write: 3000,
info: 2000,
dns: 1000,
geo: 1000,
ssl: 1000
}

constructor(pubkey, $q, rcache, config){
this.pubkey = pubkey
Expand All @@ -21,31 +54,15 @@ export class NWWorker {
this.config = config
this.setup()
this.log.info(`${this.id()} initialized`)
this.jobs = {}
this.cache_counts = {}
}

setup(){
this.setupDefaultValues()
this.setupConfig()
this.setupNocapOpts()
this.setupJobOpts()
this.setupInstances()
}

setupDefaultValues(){
this.cb = {}
this.processed = 1
this.total = 0
this.relayMeta = new Map()
this.jobOpts = {}
this.nocapOpts = {}
this.hard_stop = false
}

setupConfig(){
this.opts = this.config.nocapd

this.checks = this.opts?.checks?.enabled.includes('all')? Nocap.checksSupported(): this.opts?.checks?.enabled
this.checkOpts = this.opts?.checks?.options || {}
this.timeout = this.setTimeout(this.checkOpts?.timeout)
Expand All @@ -54,29 +71,12 @@ export class NWWorker {
this.interval = this.checkOpts?.interval? timestring(this.checkOpts.interval, 'ms'): 60*1000
this.networks = this.opts?.networks? this.opts.networks: ['clearnet']
this.log = this.config?.logger? this.config.logger: new Logger('nocap/$NWWorker')

}

setupInstances(){
this.retry = new RetryManager(`nocapd/${this.pubkey}`, this.opts?.retry, this.rcache)
}

setupNocapOpts(){
this.nocapOpts = {
timeout: this.timeout,
checked_by: this.pubkey
}
}

setupJobOpts(){
this.jobOpts ={
removeOnComplete: false,
removeOnFail: {
age: timestring('10m', 's')
}
}
}

updateJobOpts(obj){
this.jobOpts = { ...this.jobOpts, ...obj }
return this.jobOpts
Expand Down Expand Up @@ -289,15 +289,6 @@ export class NWWorker {
}

setTimeout(config){
this.timeout = {
open: 3000,
read: 3000,
write: 3000,
info: 2000,
dns: 1000,
geo: 1000,
ssl: 1000
}
if(config instanceof Object){
return this.timeout = {...this.timeout, ...config}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/trawler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": {
"@nostr-fetch/adapter-nostr-tools": "0.13.1",
"@nostrwatch/controlflow": "^0.0.3",
"@nostrwatch/logger": "^0.0.3",
"@nostrwatch/logger": "^0.0.5",
"@nostrwatch/nocap": "^0.4.0",
"@nostrwatch/nwcache": "^0.0.1",
"@nostrwatch/publisher": "^0.2.4",
Expand Down
2 changes: 1 addition & 1 deletion internal/logger/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ export default class Logger {
if (!['DEBUG'].includes(this?.log_level) && !process.env?.DEBUG) return;
this.logger.debug(message);
}
}
}
34 changes: 1 addition & 33 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1826,32 +1826,7 @@
dotenv "16.3.1"
node-schedule "2.1.1"

"@nostrwatch/logger@^0.0.3":
version "0.0.3"
resolved "https://registry.npmjs.org/@nostrwatch/logger/-/logger-0.0.3.tgz#9a492f94abe049e9bd3a0632fa28d61efab95db0"
integrity sha512-IJGb4MArQ5JGVjx0r8p3uRLqcot8zFgKeHziw/RT4j0j/1oj0WMvOSIDyTtWFDtu3i3FN1hbDC9oSnmBqjR8Cw==
dependencies:
logging "^3.3.0"

"@nostrwatch/logger@^0.0.4":
version "0.0.4"
resolved "https://registry.npmjs.org/@nostrwatch/logger/-/logger-0.0.4.tgz#25dabd5bc85a57dd5ceeaa66f2fab5fb72b5e2ef"
integrity sha512-fVdbR/TDeNMaD/8ofAN8mksR9iwTgwyQwNAkedmqk9FHdpmxViQ/6GVgyt+B3jAhgj6QkgpqOw/lWxSjdRhp1w==
dependencies:
logging "^3.3.0"

"@nostrwatch/[email protected]":
version "1.2.2"
resolved "https://registry.yarnpkg.com/@nostrwatch/nocap-every-adapter-default/-/nocap-every-adapter-default-1.2.2.tgz#05c13a5341aca57d8f2f02b9f794805fdefad774"
integrity sha512-9itPbz0nIza0vohldcxqKc+w50vGcLrOxwWg/beu6YkkLKhWa0aJa+Kp7stW6CG0puE8gVymwN/Baskybl558A==
dependencies:
"@nostrwatch/nocap-dns-adapter-default" "^1.0.2"
"@nostrwatch/nocap-geo-adapter-default" "^1.0.3"
"@nostrwatch/nocap-info-adapter-default" "^1.0.1"
"@nostrwatch/nocap-ssl-adapter-default" "^1.0.1"
"@nostrwatch/nocap-websocket-adapter-default" "^1.2.0"

"@nostrwatch/nocap@^0.4.0", "@nostrwatch/nocap@^0.4.2":
"@nostrwatch/nocap@^0.4.0":
version "0.4.7"
resolved "https://registry.yarnpkg.com/@nostrwatch/nocap/-/nocap-0.4.7.tgz#a08ee673e0c80b99a0d410ac0e75e49a3a01e25e"
integrity sha512-TZjisRYArCdfwIR0tIursD45ubL8a2HMFe+IUTc9jhU2afaCaz8SUUQGVR4Zbce0FoN2i5IjujsFHePJ3MGBIw==
Expand Down Expand Up @@ -1902,13 +1877,6 @@
dependencies:
js-yaml "4.1.0"

"@nostrwatch/[email protected]":
version "0.1.2"
resolved "https://registry.yarnpkg.com/@nostrwatch/utils/-/utils-0.1.2.tgz#49a9f4d2c492acbbe1d4ffe1eb70af7908b1a579"
integrity sha512-pB61s1cPMJGRqBXh4WlxujddQ/T9vkjoZyNUbITKsGlbvQXIW7G/mgn6Ukk+r3nux30TKYeHiJEK4YFjwS9bFw==
dependencies:
dotenv "16.3.1"

"@nostrwatch/utils@^0.0.3":
version "0.0.3"
resolved "https://registry.npmjs.org/@nostrwatch/utils/-/utils-0.0.3.tgz#465fc0caabc2486ebd2f6ea4abd08c73429a323d"
Expand Down

0 comments on commit df72ab0

Please sign in to comment.