-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New RESP2 parser #1899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New RESP2 parser #1899
Conversation
This pull request introduces 2 alerts when merging b0b2464 into 9f0f7f5 - view on LGTM.com new alerts:
|
Codecov Report
@@ Coverage Diff @@
## master #1899 +/- ##
==========================================
+ Coverage 95.37% 95.46% +0.08%
==========================================
Files 392 396 +4
Lines 3546 3682 +136
Branches 417 442 +25
==========================================
+ Hits 3382 3515 +133
- Misses 86 87 +1
- Partials 78 80 +2
Continue to review full report at Codecov.
|
|
||
it('should compose two buffers', () => { | ||
composer.write(Buffer.from([0])); | ||
assert.deepEqual( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Are deepequal comparisons expensive in node? They are in Go.
#findCRLF(chunk: Buffer): number { | ||
for (let i = this.#cursor; i < chunk.length; i++) { | ||
if (chunk[i] === CR) { | ||
return i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be a style difference. In python I'm more likely to do something like:
f = -1
for thing ... <my loop>:
if things match:
f = thing
break
return f
I find it makes it easier to read functions when you're not looking for multiple returns
|
||
#arrayItemType?: Types; | ||
|
||
#parseArray(chunk: Buffer, arraysToKeep = 0): ArrayReply | undefined { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this feels ugly - you're right.
It also looks right.
This pull request introduces 1 alert when merging 1331698 into 11b0c06 - view on LGTM.com new alerts:
|
function generateTests({ | ||
toWrite, | ||
returnStringsAsBuffers, | ||
replies | ||
}: TestsOptions): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No commenting
packages/client/lib/client/socket.ts
Outdated
} catch (err) { | ||
this.#socket.destroy(); | ||
this.#socket = undefined; | ||
|
||
throw err; | ||
if (err instanceof AuthError) { | ||
this.#isOpen = false; | ||
} | ||
|
||
if (!this.#isOpen) return; | ||
throw err; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we do console.error(err)
No description provided.