deepstreamIO / deepstream.io

deepstream.io server
https://deepstreamio.github.io
MIT License
7.14k stars 381 forks source link

Unsubscribe records not working #1047

Closed caracal7 closed 4 years ago

caracal7 commented 4 years ago
//   deepstream@5.0.9

await ds.record.getRecord(key)
    //  this callback still working after unsubscribe
    .subscribe(record => 
        console.log('subscribe cb', record)
    , true);

//   try to unsubscribe
const record = await ds.record.getRecord(key);
await record.whenReady();
record.unsubscribe();

// also did't unsubscribe
// record.discard();

UPD:

Found the problem. I forgot await record.whenReady(); between const record = await ds.record.getRecord(key); and record.discard(); in my actual code.

Everything is working as expected

yasserf commented 4 years ago

👍