Skip to content

Commit 5e9ea06

Browse files
committed
chore(coprocessor): remove set_status func
1 parent 3a5d171 commit 5e9ea06

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

coprocessor/fhevm-engine/sns-worker/src/executor.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ async fn enqueue_upload_tasks(
452452
db_txn: &mut Transaction<'_, Postgres>,
453453
tasks: &[HandleItem],
454454
) -> Result<(), ExecutionError> {
455-
for task in tasks.iter().filter(|t| t.completed()) {
455+
for task in tasks.iter().filter(|t| t.is_completed()) {
456456
task.enqueue_upload_task(db_txn).await?;
457457
}
458458

@@ -559,7 +559,6 @@ fn compute_task(
559559
match squash_noise_with_guard(&ct, enable_compression) {
560560
Ok(bytes) => {
561561
telemetry::end_span(span);
562-
task.status = TaskStatus::Completed;
563562

564563
info!(
565564
handle = handle,
@@ -578,7 +577,7 @@ fn compute_task(
578577
};
579578

580579
task.ct128 = Arc::new(BigCiphertext::new(bytes, format));
581-
task.set_status(TaskStatus::Completed);
580+
task.status = TaskStatus::Completed;
582581

583582
// Start uploading the ciphertexts as soon as the ct128 is computed
584583
//
@@ -609,7 +608,7 @@ fn compute_task(
609608
}
610609
Err(err) => {
611610
telemetry::end_span_with_err(span, err.to_string());
612-
task.set_status(TaskStatus::UnrecoverableErr(err.to_string()));
611+
task.status = TaskStatus::UnrecoverableErr(err.to_string());
613612
error!({ handle = handle, error = %err }, "Failed to convert ct");
614613
}
615614
};
@@ -682,7 +681,7 @@ async fn update_ciphertext128(
682681
// Worst-case scenario, the SnS-computation will be retried later.
683682
// However, if both DB insertion and S3 upload fail, this guarantees that the computation
684683
// will be retried and the ct128 uploaded.
685-
task.set_status(TaskStatus::TransientErr(err.to_string()));
684+
task.status = TaskStatus::TransientErr(err.to_string());
686685
}
687686
}
688687

@@ -697,7 +696,7 @@ async fn update_computations_status(
697696
tasks: &[HandleItem],
698697
) -> Result<(), ExecutionError> {
699698
for task in tasks {
700-
match task.status() {
699+
match &task.status {
701700
TaskStatus::Completed => {
702701
// Mark the computation as completed and clear transient error
703702
sqlx::query!(

coprocessor/fhevm-engine/sns-worker/src/lib.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -316,15 +316,7 @@ impl HandleItem {
316316
Ok(())
317317
}
318318

319-
fn status(&self) -> &TaskStatus {
320-
&self.status
321-
}
322-
323-
fn set_status(&mut self, status: TaskStatus) {
324-
self.status = status;
325-
}
326-
327-
fn completed(&self) -> bool {
319+
fn is_completed(&self) -> bool {
328320
matches!(self.status, TaskStatus::Completed)
329321
}
330322
}

0 commit comments

Comments
 (0)