Skip to content

fix(Client): Do not throw error on bad message#43

Merged
nokome merged 7 commits intomasterfrom
41-malformed-response
Nov 22, 2019
Merged

fix(Client): Do not throw error on bad message#43
nokome merged 7 commits intomasterfrom
41-malformed-response

Conversation

@nokome
Copy link
Copy Markdown
Member

@nokome nokome commented Nov 20, 2019

Closes #41. A remaining, related, issue is that a bad message will mean that a call to a client message never resolves. Approaches to that (for another PR) could include:

  • reject all outstanding client requests
  • have a timeout on client requests

@nokome nokome requested review from alex-ketch and beneboy November 20, 2019 10:27
Copy link
Copy Markdown
Contributor

@alex-ketch alex-ketch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm all for fewer exceptions :)

Comment thread src/stdio/StdioClientServer.test.ts Outdated
import { delay } from '../test/delay'

jest.setTimeout(30 * 1000)
jest.setTimeout(2 * 60 * 1000)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine for now (especially given the reasoning commented on line 51), but I am a little hesitant about our need to use delay and adjust setTimeout. The tests in Encoda have become quite flaky in reliability and I'd be cautious that it doesn't happen here too.
It's something that I've been meaning to look into after current work iteration.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point, I'll see if I can find a way to avoid those as part of this PR, no point _delay_ing that 😁

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the need to use delay and adjust setTimeout by using a promise on the next log event. @alex-ketch could you review those changes - I'll refactor the other tests accordingly. c4c6031

@codecov-io
Copy link
Copy Markdown

codecov-io commented Nov 20, 2019

Codecov Report

Merging #43 into master will increase coverage by 0.49%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #43      +/-   ##
==========================================
+ Coverage   86.67%   87.17%   +0.49%     
==========================================
  Files          26       27       +1     
  Lines         938      951      +13     
  Branches      178      178              
==========================================
+ Hits          813      829      +16     
+ Misses        121      118       -3     
  Partials        4        4
Impacted Files Coverage Δ
src/test/nextLogData.ts 100% <100%> (ø)
src/base/Client.ts 95.94% <100%> (+3.29%) ⬆️
src/stdio/StdioClient.ts 100% <0%> (+5%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 69ea82a...5634c95. Read the comment docs.

Copy link
Copy Markdown
Contributor

@alex-ketch alex-ketch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for making the changes @nokome

@nokome nokome merged commit 5634c95 into master Nov 22, 2019
@stencila-ci
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 0.14.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@nokome nokome deleted the 41-malformed-response branch November 27, 2019 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(Client.receive): Handle malformed responses

5 participants