fix: 🐛
This commit is contained in:
@@ -156,8 +156,9 @@ class ClientService {
|
|||||||
const that = this
|
const that = this
|
||||||
const _knownIds = new Set<string>()
|
const _knownIds = new Set<string>()
|
||||||
let events: NEvent[] = []
|
let events: NEvent[] = []
|
||||||
let started = 0
|
let startedCount = 0
|
||||||
let eosed = 0
|
let eosedCount = 0
|
||||||
|
let eosed = false
|
||||||
const subPromises = urls.map(async (url) => {
|
const subPromises = urls.map(async (url) => {
|
||||||
const relay = await this.pool.ensureRelay(url)
|
const relay = await this.pool.ensureRelay(url)
|
||||||
let hasAuthed = false
|
let hasAuthed = false
|
||||||
@@ -165,7 +166,7 @@ class ClientService {
|
|||||||
return startSub()
|
return startSub()
|
||||||
|
|
||||||
function startSub() {
|
function startSub() {
|
||||||
started++
|
startedCount++
|
||||||
return relay.subscribe([since ? { ...filter, since } : filter], {
|
return relay.subscribe([since ? { ...filter, since } : filter], {
|
||||||
alreadyHaveEvent: (id: string) => {
|
alreadyHaveEvent: (id: string) => {
|
||||||
const have = _knownIds.has(id)
|
const have = _knownIds.has(id)
|
||||||
@@ -178,7 +179,7 @@ class ClientService {
|
|||||||
onevent(evt: NEvent) {
|
onevent(evt: NEvent) {
|
||||||
that.eventDataLoader.prime(evt.id, Promise.resolve(evt))
|
that.eventDataLoader.prime(evt.id, Promise.resolve(evt))
|
||||||
// not eosed yet, push to events
|
// not eosed yet, push to events
|
||||||
if (eosed < started) {
|
if (eosedCount < startedCount) {
|
||||||
return events.push(evt)
|
return events.push(evt)
|
||||||
}
|
}
|
||||||
// eosed, (algo relay feeds) no need to sort and cache
|
// eosed, (algo relay feeds) no need to sort and cache
|
||||||
@@ -228,8 +229,10 @@ class ClientService {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
oneose() {
|
oneose() {
|
||||||
eosed++
|
eosedCount++
|
||||||
if (eosed < started) return
|
if (eosedCount < startedCount || eosed) return
|
||||||
|
|
||||||
|
eosed = true
|
||||||
|
|
||||||
// (algo feeds) no need to sort and cache
|
// (algo feeds) no need to sort and cache
|
||||||
if (!needSort) {
|
if (!needSort) {
|
||||||
|
|||||||
Reference in New Issue
Block a user