Optimize number of round-trip HTTP connections made by the client by having the submit handler return metadata about whether there are pending dump/deletion requests

For now, I'm still keeping the dedicated endpoints for those functionalities, but since most of the time there are no dump/deletion requests this should cut down the number of requests made by the client by 2/3.
This commit is contained in:
David Dworken
2023-09-21 11:35:24 -07:00
parent b05fb0f818
commit 1e43de689f
10 changed files with 156 additions and 63 deletions

View File

@ -276,7 +276,7 @@ func RunTestServer() func() {
panic(fmt.Sprintf("server failed to do something: stderr=%#v, stdout=%#v", stderr.String(), stdout.String()))
}
if strings.Contains(allOutput, "ERROR:") || strings.Contains(allOutput, "http: panic serving") {
panic(fmt.Sprintf("server experienced an error: stderr=%#v, stdout=%#v", stderr.String(), stdout.String()))
panic(fmt.Sprintf("server experienced an error\n\n\nstderr=\n%s\n\n\nstdout=%s", stderr.String(), stdout.String()))
}
// Persist test server logs for debugging
f, err := os.OpenFile("/tmp/hishtory-server.log", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
@ -325,6 +325,7 @@ func MakeFakeHistoryEntry(command string) data.HistoryEntry {
ExitCode: 2,
StartTime: time.Unix(fakeHistoryTimestamp, 0).UTC(),
EndTime: time.Unix(fakeHistoryTimestamp+3, 0).UTC(),
DeviceId: "fake_device_id",
}
}