a lot of refactos
This commit is contained in:
@@ -56,11 +56,11 @@ export class RequestorRegistry {
|
||||
updatedAt: Date.now(),
|
||||
})
|
||||
this.#ensureTick()
|
||||
this.#pushAgentEvents(this.requestors.get(id))
|
||||
|
||||
return({
|
||||
ok: true,
|
||||
frequency: frequencyMs,
|
||||
agents: matching,
|
||||
t,
|
||||
})
|
||||
}
|
||||
@@ -130,9 +130,9 @@ export class RequestorRegistry {
|
||||
return(matching)
|
||||
}
|
||||
|
||||
#pushUpdate(requestor) {
|
||||
#pushAgentEvents(requestor) {
|
||||
if(typeof(this.onPush) !== 'function') return
|
||||
this.onPush(requestor.id, {
|
||||
void this.onPush(requestor.id, {
|
||||
agents: [...requestor.agents],
|
||||
t: requestor.t,
|
||||
})
|
||||
@@ -160,7 +160,7 @@ export class RequestorRegistry {
|
||||
requestor.tickCounter++
|
||||
if(requestor.tickCounter >= requestor.pushEveryNTicks) {
|
||||
requestor.tickCounter = 0
|
||||
this.#pushUpdate(requestor)
|
||||
this.#pushAgentEvents(requestor)
|
||||
}
|
||||
}
|
||||
if(this.debug) console.log(`[Observer] Scanned ${agents.size} agent(s) for ${this.requestors.size} requestor(s)`)
|
||||
|
||||
Reference in New Issue
Block a user