Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions rust/src/runtime/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,14 +357,14 @@ where
loop {
let wake = self.wake.notified();
match self.claim_query(&body, config, &proof).await? {
QueryClaim::Task(task) => return Ok(poll_result(Some(task), "task")),
QueryClaim::Task(task) => return Ok(poll_result(Some(task), "leased")),
QueryClaim::StaleWorker => {
return Ok(poll_result(None, "stale_worker_registration"));
}
QueryClaim::Empty => {}
}
if tokio::time::Instant::now() >= deadline {
return Ok(poll_result(None, "timeout"));
return Ok(poll_result(None, "empty"));
}
if self
.poll_queue_changed(&body, "query", &mut cross_kind)
Expand Down
4 changes: 2 additions & 2 deletions rust/src/runtime/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -939,12 +939,12 @@ where
let wake = self.wake.notified();
if let Some(task) = self.claim(&body, kind, protocol_version).await? {
return Ok(
json!({"task": task, "poll_status": "task", "server_capabilities": capabilities()}),
json!({"task": task, "poll_status": "leased", "server_capabilities": capabilities()}),
);
}
if tokio::time::Instant::now() >= deadline {
return Ok(
json!({"task": null, "poll_status": "timeout", "server_capabilities": capabilities()}),
json!({"task": null, "poll_status": "empty", "server_capabilities": capabilities()}),
);
}
if self
Expand Down
6 changes: 3 additions & 3 deletions rust/tests/execution/cross_kind_poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ async fn scoped_hints_require_original_opt_in_and_a_new_ready_identity() {
let result = held.await.unwrap();
assert_eq!(result.0, StatusCode::OK, "{scenario}: {}", result.1);
assert_eq!(
result.1["poll_status"], "timeout",
result.1["poll_status"], "empty",
"{scenario}: {}",
result.1
);
Expand Down Expand Up @@ -216,7 +216,7 @@ async fn activity_admission_wakes_other_polls_but_same_kind_claim_wins() {
json!({"lease_owner":"mixed","activity_attempt_id":activity["activity_attempt_id"],"result":envelope(Payload::Null)})).await.0,StatusCode::OK);
let result = held.await.unwrap();
assert_eq!(result.0, StatusCode::OK, "{}", result.1);
assert_eq!(result.1["poll_status"], "task");
assert_eq!(result.1["poll_status"], "leased");
assert!(result.1["task"].is_object());
runtime.close().await;
database.remove().await;
Expand Down Expand Up @@ -311,7 +311,7 @@ async fn zero_timeout_polls_keep_the_existing_empty_reply() {
)
.await;
assert_eq!(result.0, StatusCode::OK, "{}", result.1);
assert_eq!(result.1["poll_status"], "timeout");
assert_eq!(result.1["poll_status"], "empty");
assert_eq!(result.1.get("task"), Some(&Value::Null));
}
runtime.close().await;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function checkCrossKindPollWake(record, profile) {
}
const sweep = following[sweepIndex];
assert.equal(sweep.http, 200);
assert(['task', 'leased'].includes(sweep.poll_status));
assert.equal(sweep.poll_status, 'leased', 'a claim reports leased, as the worker protocol requires');
assert.equal(sweep.task_is_null, false);
assert.equal(typeof sweep.task_id, 'string');
assert(sweep.task_id.length > 0, 'the ordinary poll separately grants a task');
Expand Down
Loading