chrome-devtools-autosave-server
chrome-devtools-autosave-server copied to clipboard
Queue file writes
Let's say we have 3 request happens almost at the same time:
request #1
|
r1
r2
r3
We begin writing to the file when request event 'end' fires. Writing to the file takes much more time than processing a request (parse HTTP headers and stuff):
begin writing end writing
| |
r1-b------------e
r2
r3
Where is no need to write second request r2 — we're going to rewrite it anyway. We could just write the third r3 when the first is done:
begin writing end writing
| |
r1-b------------e
r2
r3....b------------e
Or, we could stop writing the current request when the next one is available:
stop writing
|
r1-b-----s
r2--b-s
r3-b------------e