nikeee / node-ts

Node.js TeamSpeak® 3 Server Query client implemented in TypeScript
GNU Lesser General Public License v3.0
38 stars 6 forks source link

Fix Queue #21

Closed DerZade closed 3 years ago

DerZade commented 3 years ago

At the moment the "queue" isn't really a queue because we don't check if a QueryCommand is currently processed before overwriting it with the first item of the queue. So every item is just processed right away, without even checking if we finished processing the previous command.

This has some nasty side effects. Let's take the following example:

query.send('clientlist', {}).then(r => console.log('clientlist', r.rawResponse));
query.send('serverinfo').then(r => console.log('serverinfo', r.rawResponse));
  1. The first promise (clientlist) will never be resolved
  2. The second promise (serverinfo) will resolve, but with the response of the clientlist query

I tried it out and got the following output: serverinfo clid=25*** cid=8* client_database_id=1** client_nickname=[A]\sXiviD client_type=1| ...

nikeee commented 3 years ago

Cool, thanks!

Do you participate in hacktoberfest? If so, I'd label this PR for that.

DerZade commented 3 years ago

Do you participate in hacktoberfest? If so, I'd label this PR for that.

Nope. I just found the bug and thought before just opening an issue I could try to fix it. :D

DerZade commented 3 years ago

No pressure, but any chance this could be released soon? 😉

I just realized I would need it earlier than expected. 😅

nikeee commented 3 years ago

I'll release it in about 7h.

nikeee commented 3 years ago

CD will release it as 5.1.0.

Edit: Package created, CD is just currently broken. I'm deploying this manually later this day.