Skip to content

Commit 2b6c080

Browse files
committed
refactor: optimize request_sign_data execution using block_in_place for improved performance
1 parent 9600540 commit 2b6c080

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/signer.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ impl Signer for GcpSigner {
151151
&self,
152152
message: &[u8],
153153
) -> Result<solana_sdk::signature::Signature, SignerError> {
154-
let rt = tokio::runtime::Runtime::new()
155-
.map_err(|e| SignerError::Custom(format!("Failed to create tokio runtime: {:?}", e)))?;
156-
157-
rt.block_on(request_sign_data(&self.client, &self.key_name, message))
158-
.and_then(decode_signature)
159-
.map_err(Into::into)
154+
tokio::task::block_in_place(|| {
155+
tokio::runtime::Handle::current()
156+
.block_on(request_sign_data(&self.client, &self.key_name, message))
157+
.and_then(decode_signature)
158+
.map_err(Into::into)
159+
})
160160
}
161161

162162
fn is_interactive(&self) -> bool {

0 commit comments

Comments
 (0)