CardanoSolutions / ogmios

❇️ A WebSocket JSON/RPC bridge for Cardano
https://ogmios.dev
Mozilla Public License 2.0
304 stars 90 forks source link

client/TypeScript Local state query client acquired point expired exception handling #87

Closed rhyslbw closed 2 years ago

rhyslbw commented 3 years ago

(and I am pretty sure I raised this in the past and your answer was: doesn't matter because a new client is created for every request)

The state query client return here is "static", so it would only works for a certain time, until the acquired point expired. It would not be a major issue if requests were merely fired immediately, but by returning an intermediate object which does not re-acquire between requests we may end up in bad situations? What mechanisms are given to the client to cope with that? Is it simply that clients are encouraged to create a new client for each request :thinking: ?

Originally posted by @KtorZ in https://github.com/CardanoSolutions/ogmios/pull/77#r671010358

KtorZ commented 2 years ago

Looking at the current code, I think this is mostly fine in the sense that:

One thing that is missing is the ability to release, so that users don't have to necessarily throw away clients. Also, I noticed that the current clients registers handlers even if no points are provided, which may lead to memory leak.

Both points addressed in bfdd334db56c8ee35d86989a911ca385f5d7cdb6 and 1ebfdea2ace861a00e2818cbff742b30d1402e6b