Skip to content

Commit

Permalink
Merge pull request #2 from canhazdb/memory_leak
Browse files Browse the repository at this point in the history
Memory leak
  • Loading branch information
markwylde committed Jun 5, 2021
2 parents 4d9533c + 5ca8f72 commit cc4e16c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,13 @@ function client (rootUrl, clientOptions) {
const rawData = JSON.parse(event.data);
const [type, data] = rawData;
if (type === 'A') {
const accepter = onOffAccepts.find(item => item[0] === data);
const accepterIndex = onOffAccepts.findIndex(item => item[0] === data);
if (accepterIndex === -1) {
return
}
const accepter = onOffAccepts[accepterIndex];
accepter && accepter[1] && accepter[1](null, rawData[2]);
onOffAccepts.splice(accepterIndex, 1);
return;
}
handlers.forEach(item => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "canhazdb-client",
"version": "1.1.2",
"version": "1.1.3",
"description": "Talk to a restful api using database like functions.",
"main": "index.js",
"directories": {
Expand Down

0 comments on commit cc4e16c

Please sign in to comment.