Skip to content

Commit

Permalink
remove logging
Browse files Browse the repository at this point in the history
  • Loading branch information
dskvr committed Feb 17, 2023
1 parent df79b01 commit cf3f7f9
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 35 deletions.
1 change: 0 additions & 1 deletion src/components/partials/FiltersPartial.vue
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@
return
this.activeNavItem = this.store.layout.getActiveItem('relays/find').slug
this.refreshCounts( this.getRelays(this.store.relays.getAll) )
console.log('refresh!')
},
resetFilters(){
this.store.filters.reset()
Expand Down
1 change: 0 additions & 1 deletion src/components/relays/jobs/GetPulse.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import { RelayPool } from 'nostr'
const localMethods = {
invalidatePulse(force){
console.log('invalidate pulse')
if( (!this.isExpired(this.slug, 1) && !force) && !this.isSingle )
return
Expand Down
4 changes: 1 addition & 3 deletions src/components/relays/jobs/GetTopics.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ const LocalMethods = {
.on('event', async (r, sub_id, event) => {
if(subid === sub_id){
const relay = event.tags.filter( tag => 'd' === tag[0])?.[0]
const data = JSON.parse(event.content)
const topics = event.tags.filter( tag => 't' === tag[0])
console.log(relay, data)
chunkResults[relay] = {}
if(topics)
chunkResults[relay].topics = this.cleanTopics(topics)
Expand All @@ -75,7 +73,7 @@ const LocalMethods = {
})
promises.push(promise)
console.log('results', Object.keys(this.store.results.all).length, 'chunk results', Object.keys(chunkResults).length)
// console.log('results', Object.keys(this.store.results.all).length, 'chunk results', Object.keys(chunkResults).length)
await Promise.all(promises)
this.store.results.merge(chunkResults)
promises = []
Expand Down
4 changes: 2 additions & 2 deletions src/components/relays/jobs/JobQueue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default defineComponent({
},
methods: {
async tick(){
console.log('pending', this.store.jobs.pending)
// console.log('pending', this.store.jobs.pending)
if(this.currentJob === this.store.jobs.getActiveSlug)
return
this.currentJob = this.store.jobs.getActiveSlug
Expand All @@ -156,7 +156,7 @@ export default defineComponent({
async processJob(){
if(!(this.store.jobs.active?.handler instanceof Function))
return
console.log('processJob()', this.store.jobs.active.id, 'type', typeof this.store.jobs.active.handler, 'is async', this.store.jobs.active.handler instanceof this.AsyncFunction)
// console.log('processJob()', this.store.jobs.active.id, 'type', typeof this.store.jobs.active.handler, 'is async', this.store.jobs.active.handler instanceof this.AsyncFunction)
if(this.store.jobs.active.handler instanceof this.AsyncFunction)
await this.store.jobs.active.handler()
else
Expand Down
4 changes: 2 additions & 2 deletions src/components/relays/jobs/LoadSeed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const localMethods = {
if(topics.length)
result.topics = this.cleanTopics(topics)
console.log('aggr', this.result.url, this.getAggregate(result), result.check.connect, result.check.read, result.check.write)
// console.log('aggr', this.result.url, this.getAggregate(result), result.check.connect, result.check.read, result.check.write)
result.aggregate = this.getAggregate(result)
Expand All @@ -162,7 +162,7 @@ const localMethods = {
resolve()
})
})
console.log('results chunk', Object.keys(resultsChunk).length)
// console.log('results chunk', Object.keys(resultsChunk).length)
promises.push(promise)
this.store.results.mergeLeft(resultsChunk)
await new Promise( resolveDelay => setTimeout( resolveDelay, 500 ) )
Expand Down
9 changes: 4 additions & 5 deletions src/components/relays/jobs/RefreshJob.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const localMethods = {
if(!this.windowActive)
return
console.log('queue job', single, this.slug)
// console.log('queue job', single, this.slug)
this.queueJob(
this.slug,
Expand Down Expand Up @@ -141,7 +141,7 @@ const localMethods = {
}
await Promise.all(promises)
this.store.results.mergeDeep(resultsChunk)
console.log('merging', Object.keys(resultsChunk).length, 'into', Object.keys(this.store.results.all))
// console.log('merging', Object.keys(resultsChunk).length, 'into', Object.keys(this.store.results.all))
}
}
this.completeAll(single)
Expand Down Expand Up @@ -181,7 +181,7 @@ const localMethods = {
},
check: async function(relay){
console.log('checking', relay)
// console.log('checking', relay)
if(this.stop)
return
return new Promise( (resolve) => {
Expand Down Expand Up @@ -209,7 +209,7 @@ const localMethods = {
.on('open', () => {
})
.on('complete', (instance) => {
console.log('aggr', instance.result.url, this.getAggregate(instance.result), instance.result.check.connect, instance.result.check.read, instance.result.check.write)
// console.log('aggr', instance.result.url, this.getAggregate(instance.result), instance.result.check.connect, instance.result.check.read, instance.result.check.write)
instance.result.aggregate = this.getAggregate(instance.result)
instance.result.log = instance.log
this.closeRelay(instance.relay)
Expand Down Expand Up @@ -376,7 +376,6 @@ export default defineComponent({
mounted(){
if( this.isSingle ){
console.log('is single')
this.slug = `relays/check/${this.relayFromUrl}`
this.CheckRelaysJob(true, this.relayFromUrl)
// this.runLatencyCheck()
Expand Down
4 changes: 1 addition & 3 deletions src/components/relays/pages/RelaysSingle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -720,8 +720,6 @@ export default defineComponent({
},
async mounted() {
// this.getAdminNotes()
console.log('store?', Object.keys(this.store))
this.interval = setInterval(() => {
this.setData()
},1000)
Expand Down Expand Up @@ -951,7 +949,7 @@ export default defineComponent({
this.lastUpdate = this.store.jobs.getLastUpdate('relays')
this.relay = this.relayFromUrl
console.log(this.relay, this.store.relays.getGeo(this.relay))
// console.log(this.relay, this.store.relays.getGeo(this.relay))
this.geo = this.store.relays.getGeo(this.relay)
Expand Down
2 changes: 1 addition & 1 deletion src/store/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const useUserStore = defineStore('user', {
const store = useRelaysStore()
const relays = store.getFavorites.length ? store.getFavorites : ['wss://nostr.sandwich.farm']
this.kind3Event = await subscribeKind3(this.pubKey, relays)
console.log('kind3', this.kind3Event)
// console.log('kind3', this.kind3Event)
return this.kind3Event?.content || {}
},
setKind3: async function(obj) {
Expand Down
29 changes: 12 additions & 17 deletions src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ export const subscribeKind3 = async function(pubkey, relays){
ordered = [],
total = relays.length

let eose = 0,
events = 0
let eose = 0

const complete = function(){
if(!ordered.length)
Expand All @@ -153,25 +152,21 @@ export const subscribeKind3 = async function(pubkey, relays){
})
})
.on('event', (relay, _subid, ev) => {
if(_subid !== subid)
return

if(_subid == subid){
if(!ev.content.length)
return
// console.log('the content', ev.content)
try {
ev.content = JSON.parse(ev.content)
}
catch(e){
ev.content = {}
}
ordered.push(ev)
events++
console.log('events', events, '/', total)
if(!ev.content.length)
return
try {
ev.content = JSON.parse(ev.content)
}

catch(e){
ev.content = {}
}
ordered.push(ev)
})
.on('eose', () => {
console.log('eose', eose, '/', total, eose < total)
// console.log('eose', eose, '/', total, eose < total)
eose++
if(eose < total)
return
Expand Down

0 comments on commit cf3f7f9

Please sign in to comment.