Patch bash history import regression (#970)

* At least patch this on the server side so we don't loop forever

* Postgres doesn't support <microsecond precision

Use millis - almost everything should support them and they are still
faster than a human can reasonably spam a button.
This commit is contained in:
Ellie Huxtable 2023-05-10 09:02:35 -04:00 committed by GitHub
parent 4a9a626e17
commit bf7432f392
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -62,7 +62,7 @@ impl Importer for Bash {
// this increment is deliberately very small to prevent particularly fast fingers
// causing ordering issues; it also helps in handling the "here document" syntax,
// where several lines are recorded in succession without individual timestamps
let timestamp_increment = Duration::nanoseconds(1);
let timestamp_increment = Duration::milliseconds(1);
// make sure there is a minimum amount of time before the first known timestamp
// to fit all commands, given the default increment

View file

@ -53,6 +53,14 @@ pub async fn list<DB: Database>(
)
.await;
if req.sync_ts.timestamp_nanos() < 0 || req.history_ts.timestamp_nanos() < 0 {
error!("client asked for history from < epoch 0");
return Err(
ErrorResponse::reply("asked for history from before epoch 0")
.with_status(StatusCode::BAD_REQUEST),
);
}
if let Err(e) = history {
error!("failed to load history: {}", e);
return Err(ErrorResponse::reply("failed to load history")