deepstreamIO / deepstream.io-client-js

The Browser / Node.js Client for deepstream.io
Other
294 stars 109 forks source link

Discard list still get event handler triggered #597

Closed geohuz closed 1 year ago

geohuz commented 1 year ago

After issuing list.discard() I can still get entry-added entry-removed event triggered. Only after adding list.callbacks.clear() stop the event. Further more, if examine the list, I can still find entries in list.record, I'm not sure if there is a problem, In a scenario which I need to dispose the current list and record listeners and subscribers and do a reload with another list, does record.discard and list.discard ensure the GC will not cause memory leaks?

jaime-ez commented 1 year ago

There is a client setting, recordDiscardTimeout, this gives a buffer time before actually discarding the record. If you wait five seconds, the default value, you'll see the entry-added event is no longer triggered. And if you set the recordDiscardTimeout to 0 you'll see its instant.