JsCommunity / JsCommunity/json-rpc-peer
Feat: add a timeout option to Peer
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 13
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
Currently, we can only call failPendingRequests() to make all the pending requests fail.
Sometimes it's better to set a timeout value and let the request failed automatically when it runs time out.
The simplest modification should be to add a timeout argument to failPendingRequests(timeout: number), which can be called period and clean the timeout-ed requests.
A better way to implement it might integrate the timeout with the Peer class.
For example:
interface PeerOptions {
timeout: number
}
class Peer {
constructor(public options: PeerOptions) {
}
// request will be rejected if it did not get any response from the server after timeout milliseconds.
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the Peer class and the existing failPendingRequests() handling for pending requests. Determine how timeout configuration should be exposed and how timed-out requests are rejected and cleaned up; done means requests without responses fail automatically after the configured milliseconds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100