Skip to content

Commit d8e5c27

Browse files
authored
fix(interactive): add logs when return result in GRPC (#4328)
<!-- Thanks for your contribution! please review https://github.com/alibaba/GraphScope/blob/main/CONTRIBUTING.md before opening an issue. --> ## What do these changes do? <!-- Please give a short brief about these changes. --> As titled. ## Related issue number <!-- Are there any issues opened that will be resolved by merging this change? --> Fixes
1 parent a8952a4 commit d8e5c27

File tree

1 file changed

+16
-4
lines changed
  • interactive_engine/executor/engine/pegasus/server/src

1 file changed

+16
-4
lines changed

interactive_engine/executor/engine/pegasus/server/src/rpc.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ impl FromStream<Vec<u8>> for RpcSink {
8282
fn on_next(&mut self, resp: Vec<u8>) -> FnResult<()> {
8383
// todo: use bytes to alleviate copy & allocate cost;
8484
let res = pb::JobResponse { job_id: self.job_id, resp };
85-
self.tx.send(Ok(res)).ok();
86-
Ok(())
85+
debug!("rpc send response for job {}", self.job_id);
86+
self.tx
87+
.send(Ok(res))
88+
.map_err(|e| Box::new(e) as Box<dyn Error + Send>)
8789
}
8890
}
8991

@@ -115,7 +117,11 @@ impl FromStreamExt<Vec<u8>> for RpcSink {
115117
Status::unknown(format!("{:?}", server_error))
116118
};
117119

118-
self.tx.send(Err(status)).ok();
120+
if let Err(e) = self.tx.send(Err(status)) {
121+
error!("rpc send error failure for job {}: {:?}", self.job_id, e);
122+
} else {
123+
info!("rpc send error success for job {}", self.job_id);
124+
}
119125
}
120126
}
121127

@@ -124,8 +130,14 @@ impl Drop for RpcSink {
124130
let before_sub = self.peers.fetch_sub(1, Ordering::SeqCst);
125131
if before_sub == 1 {
126132
if !self.had_error.load(Ordering::SeqCst) {
127-
self.tx.send(Err(Status::ok("ok"))).ok();
133+
if let Err(e) = self.tx.send(Err(Status::ok("ok"))) {
134+
error!("rpc send complete failure for job {}: {:?}", self.job_id, e);
135+
} else {
136+
info!("rpc send complete success for job {}", self.job_id);
137+
}
128138
}
139+
} else {
140+
debug!("rpc send success for job {}, {} left;", self.job_id, before_sub - 1);
129141
}
130142
}
131143
}

0 commit comments

Comments
 (0)