Skip to content

Commit

Permalink
[ISSUE #1553]🔥Optimize rocketmq-namesrv crate DefaultRequestProcessor…
Browse files Browse the repository at this point in the history
… error handle⚡️ (#1561)
  • Loading branch information
mxsm authored Dec 5, 2024
1 parent f80f3a8 commit 1892a08
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
23 changes: 11 additions & 12 deletions rocketmq-namesrv/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,16 @@ impl RequestProcessor for NameServerRequestProcessor {
) -> Result<Option<RemotingCommand>> {
let request_code = RequestCode::from(request.code());
info!("Name server Received request code: {:?}", request_code);
match request_code {
RequestCode::GetRouteinfoByTopic => self
.client_request_processor
.process_request(channel, ctx, request_code, request)
.map_err(Into::into),
_ => Ok(self.default_request_processor.process_request(
channel,
ctx,
request_code,
request,
)),
}
let result = match request_code {
RequestCode::GetRouteinfoByTopic => {
self.client_request_processor
.process_request(channel, ctx, request_code, request)
}
_ => {
self.default_request_processor
.process_request(channel, ctx, request_code, request)
}
};
result.map_err(Into::into)
}
}
4 changes: 2 additions & 2 deletions rocketmq-namesrv/src/processor/default_request_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl DefaultRequestProcessor {
_ctx: ConnectionHandlerContext,
request_code: RequestCode,
request: RemotingCommand,
) -> Option<RemotingCommand> {
) -> crate::Result<Option<RemotingCommand>> {
let response = match request_code {
RequestCode::PutKvConfig => self.put_kv_config(request),
RequestCode::GetKvConfig => self.get_kv_config(request),
Expand Down Expand Up @@ -111,7 +111,7 @@ impl DefaultRequestProcessor {
RemotingSysResponseCode::SystemError,
),
};
Some(response)
Ok(Some(response))
}
}

Expand Down

0 comments on commit 1892a08

Please sign in to comment.