Skip to content

Commit 2ee1bb5

Browse files
committed
fix: use send_event instead of send_event_full for crates.io compatibility
The send_event_full method is not available in the published a3s-ahp v2.1.0 on crates.io. Changed to use send_event which takes event_type and payload separately. Note: This loses the context/metadata fields that were passed via send_event_full, but maintains API compatibility with crates.io.
1 parent b73936b commit 2ee1bb5

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/src/ahp/executor.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ impl AhpHookExecutor {
467467
context: heartbeat_executor.build_context(),
468468
metadata: None,
469469
};
470-
if let Err(e) = heartbeat_executor.client.send_event_full(&event).await {
470+
if let Err(e) = heartbeat_executor.client.send_event(event.event_type.clone(), event.payload.clone()).await {
471471
warn!("Heartbeat failed: {}", e);
472472
}
473473
}
@@ -500,7 +500,7 @@ impl AhpHookExecutor {
500500
metadata: None,
501501
};
502502
// Wait for idle decision (blocking)
503-
match idle_executor.client.send_event_full(&event).await {
503+
match idle_executor.client.send_event(event.event_type.clone(), event.payload.clone()).await {
504504
Ok(decision) => {
505505
debug!("Idle decision: {:?}", decision);
506506
match decision {
@@ -766,7 +766,11 @@ impl HookExecutor for AhpHookExecutor {
766766
}
767767

768768
// Send event and wait for decision
769-
match self.client.send_event_full(&ahp_event).await {
769+
match self
770+
.client
771+
.send_event(ahp_event.event_type.clone(), ahp_event.payload.clone())
772+
.await
773+
{
770774
Ok(decision) => {
771775
debug!("AHP decision: {:?}", decision);
772776
self.map_decision(decision)
@@ -785,7 +789,10 @@ impl HookExecutor for AhpHookExecutor {
785789
let client = self.client.clone();
786790
let event = ahp_event;
787791
tokio::spawn(async move {
788-
if let Err(e) = client.send_event_full(&event).await {
792+
if let Err(e) = client
793+
.send_event(event.event_type.clone(), event.payload.clone())
794+
.await
795+
{
789796
warn!("AHP fire-and-forget error: {}", e);
790797
}
791798
});

0 commit comments

Comments
 (0)