First request always takes at least 200 milliseconds
- Dominant language
- TypeScript
- Stars
- 40k
- Forks
- 2.4k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 61
Description
### Expected Behavior
The first request should match the latency of the subsequent requests. The subsequent requests are in the impressive 0.7 - 1.0 ms range, which is faster than Postman. By quickly clicking "Send" over and over, the subsequent requests get this time.
### Actual Behavior
The first request is actually 200+ ms. Postman is not inconsistent like this.
### Reproduction Steps
The "first" request happens if it's the first request after opening Insomnia, or by waiting 5 seconds before sending it.
Sample code:
```js
const http = require('http');
const PORT = 3000;
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World!');
}).listen(PORT);
```
Prerequisite for my sample code:
- Install [node.js](https://nodejs.org/en/download/)
- Pick an available port for the script.
- Start with `node sampleScriptName.js`
- Open Insomnia and add a GET request `http://localhost:3000`
Method 1:
1. Open Insomnia
2. Send the request
3. It takes 200+ ms
Method 2:
1. Insomnia is already open
2. Wait at least 5 seconds after the previous request
3. Send the request
4. It takes 200+ ms
### Is there an existing issue for this?
- [X] I have searched the [issue tracker](https://www.github.com/Kong/insomnia/issues) for this problem.
### Additional Information
I have also reproduced the error in Insomnia 2022.5.0-beta.5
### Insomnia Version
2022.4.2
### What operating system are you using?
Windows
### Operating System Version
Windows 10 Version 21H2 19044.1826
### Installation method
download from insomnia.rest
### Last Known Working Insomnia version
N/A
Contributor guide
Research direction
Reproduce the delay using the provided Node.js HTTP server and an Insomnia GET request to localhost, comparing the first request with requests sent within five seconds. Investigate the request lifecycle around opening Insomnia and the idle period; done means the first and delayed requests have latency comparable to subsequent requests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- desktop, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100