Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

Fix deleting connection.sid from pool before disconnecting it #5

Closed
wants to merge 2 commits into from

Conversation

jpreynat
Copy link
Contributor

@jpreynat jpreynat commented Mar 3, 2016

Calling client.clientEnd() causes the following error:

TypeError: Cannot read property 'disconnect' of undefined
      at node_modules/thunk-disque/lib/client.js:88:17
      at Object.exports.each (node_modules/thunk-disque/lib/tool.js:39:59)
      at DisqueClient.clientEnd (node_modules/thunk-disque/lib/client.js:87:10)
      ...

Deleting the connection's sid from disqueState.pool in lib/connection:

  disconnect () {
    ...
    let disqueState = this.disque._disqueState
    delete disqueState.pool[this.id]
    delete disqueState.pool[this.sid] // faulty line

causes the each function to crash when reaching the actual connection's sid in lib/client:

    tool.each(disqueState.pool, (connection, key) => {
      connection.disconnect()
      delete disqueState.pool[key]
    })

Can you please take this PR into account for a 0.5.1 release ?

Thanks in advance.

@zensh zensh closed this in 8c76d82 Mar 4, 2016
@zensh
Copy link
Member

zensh commented Mar 4, 2016

Thank you for your PR. I fixed it with another way 8c76d82#diff-50cfa59973c04321b5da0c6da0fdf4feR92

v0.5.1 released.

@zensh
Copy link
Member

zensh commented Mar 4, 2016

It need more tests, I will work it in this days

@jpreynat
Copy link
Contributor Author

jpreynat commented Mar 4, 2016

No problem, you know best how to fix this.
Thanks for upgrading it so quickly!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants