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⚡️
  • Loading branch information
mxsm committed Dec 5, 2024
1 parent f80f3a8 commit 12a077b
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 {

Check warning on line 50 in rocketmq-namesrv/src/processor.rs

View check run for this annotation

Codecov / codecov/patch

rocketmq-namesrv/src/processor.rs#L50

Added line #L50 was not covered by tests
RequestCode::GetRouteinfoByTopic => {
self.client_request_processor
.process_request(channel, ctx, request_code, request)

Check warning on line 53 in rocketmq-namesrv/src/processor.rs

View check run for this annotation

Codecov / codecov/patch

rocketmq-namesrv/src/processor.rs#L52-L53

Added lines #L52 - L53 were not covered by tests
}
_ => {
self.default_request_processor
.process_request(channel, ctx, request_code, request)

Check warning on line 57 in rocketmq-namesrv/src/processor.rs

View check run for this annotation

Codecov / codecov/patch

rocketmq-namesrv/src/processor.rs#L56-L57

Added lines #L56 - L57 were not covered by tests
}
};
result.map_err(Into::into)

Check warning on line 60 in rocketmq-namesrv/src/processor.rs

View check run for this annotation

Codecov / codecov/patch

rocketmq-namesrv/src/processor.rs#L60

Added line #L60 was not covered by tests
}
}
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>> {

Check warning on line 78 in rocketmq-namesrv/src/processor/default_request_processor.rs

View check run for this annotation

Codecov / codecov/patch

rocketmq-namesrv/src/processor/default_request_processor.rs#L78

Added line #L78 was not covered by tests
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))

Check warning on line 114 in rocketmq-namesrv/src/processor/default_request_processor.rs

View check run for this annotation

Codecov / codecov/patch

rocketmq-namesrv/src/processor/default_request_processor.rs#L114

Added line #L114 was not covered by tests
}
}

Expand Down

0 comments on commit 12a077b

Please sign in to comment.