nbd-wtf / nostr-tools

Tools for developing Nostr clients.
The Unlicense
705 stars 197 forks source link

Program Not Terminating After Event Handling and Subscription Closure #339

Open richard16611 opened 10 months ago

richard16611 commented 10 months ago

The following code successfully retrieves events and seems to close the subscription, but the program doesn't terminate.

const events = await pool.querySync(relays, { authors: [pk]})
console.log(events)

Same goes to:

await pool.subscribeManyEose(
  relays,
  [
    {
      authors: [pk],
    },
  ],
  {
    onevent(event) {
      console.log("got event", event)
    },
    onclose() {
      console.log("subscription closed")
    },
  }
)

The events are received and the 'subscription closed' message is logged, but the program isn't terminating. Maybe this is the intended and expected behavior, I just want to make sure.

I'm running in Bun runtime.