Skip to content

Conversation

@eudelins-zama
Copy link
Contributor

@eudelins-zama eudelins-zama commented Oct 27, 2025

@eudelins-zama eudelins-zama requested a review from Copilot October 27, 2025 13:06
@cla-bot cla-bot bot added the cla-signed label Oct 27, 2025
@eudelins-zama eudelins-zama self-assigned this Oct 27, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements an optimization to immediately poll for gRPC responses when a request has already been sent to the KMS, rather than attempting to resend it. This is achieved by tracking request state through a new already_sent boolean field.

Key Changes:

  • Added already_sent field to track whether a request has been sent to the KMS
  • Modified request sending logic to skip resending when already_sent is true
  • Updated database schema and queries to persist the already_sent state

Reviewed Changes

Copilot reviewed 9 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
kms_response.rs Updated to pass already_sent=true when marking events as pending after processing responses
gw_event.rs Added already_sent field to GatewayEvent struct and updated all related functions to handle this field
kms_worker.rs Changed event parameter to mutable to allow updating already_sent state during processing
processor.rs Updated trait and implementation signatures to accept mutable event references
kms_client.rs Implemented logic to conditionally send requests based on already_sent flag and updated error message
simple.rs, parallel.rs Updated test fixtures to include already_sent: false in expected results
20251027122128_add_already_sent.sql Migration adding already_sent column to all request tables
20250826111757_keygen_crs.sql Added error handling for enum type creation to prevent migration failures
Files not reviewed (7)
  • kms-connector/.sqlx/query-0c7e1f45677401d5bf8d0dce8849637a4b533c4371b1620f9259529a1bfebc27.json: Language not supported
  • kms-connector/.sqlx/query-12d768492b153b53cf4cb6c9f3e66c1940b5f4f6306113ff9648f690f1379240.json: Language not supported
  • kms-connector/.sqlx/query-2c1c41025c09656ec4aa9a6e8ee58b52cadbc7039cf07d158f70dfc46b5e06eb.json: Language not supported
  • kms-connector/.sqlx/query-976df9ddb90a8496ff6392dce98caffef797e8177193bf4711fafa1aab746040.json: Language not supported
  • kms-connector/.sqlx/query-9e6abfc0df77b3587972fc590ee888338d1e9a3d4f2bdb506d8588319adad879.json: Language not supported
  • kms-connector/.sqlx/query-ae80f83b6a6f16cd77a8e1a8a177ca8631cf6a17fc91e6f6784d160ceedfcb98.json: Language not supported
  • kms-connector/.sqlx/query-f9e4703b71b26e3c08ecb4960d8c9ff833085240442de258975cde391de302a2.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +163 to +164
"UPDATE public_decryption_requests SET under_process = FALSE, already_sent = $1 \
WHERE decryption_id = $2",
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SQL update statement now sets already_sent alongside under_process = FALSE. This logic seems counterintuitive: when marking an event as pending (not under process), we're setting already_sent which could be either true or false. If already_sent = true, it suggests the request was sent but is now being marked as pending again, potentially for retry. Consider adding a comment explaining this behavior, as the relationship between 'pending' and 'already_sent' is not immediately clear.

Copilot uses AI. Check for mistakes.
@eudelins-zama eudelins-zama force-pushed the eudelins/chore/no-retry-if-grpc-already-sent branch from 171071f to 0a97cad Compare October 27, 2025 13:37
@eudelins-zama
Copy link
Contributor Author

Replaced by #1241

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants