Add missing update of last_prediction_refresh (#43483)
Fixes a regression introduced in https://github.com/zed-industries/zed/pull/43284 where edit predictions stopped being throttled at all 😬 Release Notes: - N/A Co-authored-by: Ben Kunkle <ben@zed.dev>
This commit is contained in:
co-authored by
Ben Kunkle
parent
36708c910a
commit
fb0fcd86fd
@@ -1123,7 +1123,6 @@ impl Zeta {
|
|||||||
zeta_project.next_pending_prediction_id += 1;
|
zeta_project.next_pending_prediction_id += 1;
|
||||||
let last_request = zeta_project.last_prediction_refresh;
|
let last_request = zeta_project.last_prediction_refresh;
|
||||||
|
|
||||||
// TODO report cancelled requests like in zeta1
|
|
||||||
let task = cx.spawn(async move |this, cx| {
|
let task = cx.spawn(async move |this, cx| {
|
||||||
if let Some((last_entity, last_timestamp)) = last_request
|
if let Some((last_entity, last_timestamp)) = last_request
|
||||||
&& throttle_entity == last_entity
|
&& throttle_entity == last_entity
|
||||||
@@ -1133,6 +1132,12 @@ impl Zeta {
|
|||||||
cx.background_executor().timer(timeout).await;
|
cx.background_executor().timer(timeout).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.update(cx, |this, cx| {
|
||||||
|
this.get_or_init_zeta_project(&project, cx)
|
||||||
|
.last_prediction_refresh = Some((throttle_entity, Instant::now()));
|
||||||
|
})
|
||||||
|
.ok();
|
||||||
|
|
||||||
let edit_prediction_id = do_refresh(this.clone(), cx).await.log_err().flatten();
|
let edit_prediction_id = do_refresh(this.clone(), cx).await.log_err().flatten();
|
||||||
|
|
||||||
// When a prediction completes, remove it from the pending list, and cancel
|
// When a prediction completes, remove it from the pending list, and cancel
|
||||||
|
|||||||
Reference in New Issue
Block a user