Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #22] optimize code and codeCov enhancing of protocol.mqtt.handler #63

Merged
merged 1 commit into from
Apr 11, 2022
Merged

[ISSUE #22] optimize code and codeCov enhancing of protocol.mqtt.handler #63

merged 1 commit into from
Apr 11, 2022

Conversation

YxAc
Copy link
Contributor

@YxAc YxAc commented Apr 10, 2022

code optimization and codeCov enhancing of mqtt.cs.protocol.mqtt.handler for #22

if (mqttConnectReturnCode == null) {
channelManager.closeConnect(channel, ChannelCloseFrom.SERVER, remark);
return;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the if judgment for #61

channel.writeAndFlush(getMqttConnAckMessage(mqttConnectReturnCode));
channelManager.closeConnect(channel, ChannelCloseFrom.SERVER, remark);
return;
}

CompletableFuture<Void> future = new CompletableFuture<>();
ChannelInfo.setFuture(channel, ChannelInfo.FUTURE_CONNECT, future);

// use 'scheduler' to separate two i/o: 'ack to client' and 'session-load from rocketmq'
Copy link
Contributor Author

@YxAc YxAc Apr 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add comment for 'scheduler'

@codecov-commenter
Copy link

Codecov Report

Merging #63 (a7f2bb1) into main (c7d6809) will increase coverage by 2.56%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #63      +/-   ##
==========================================
+ Coverage   23.77%   26.34%   +2.56%     
==========================================
  Files          96       96              
  Lines        4176     4171       -5     
  Branches      662      659       -3     
==========================================
+ Hits          993     1099     +106     
+ Misses       2960     2848     -112     
- Partials      223      224       +1     
Impacted Files Coverage Δ
...t/cs/protocol/mqtt/handler/MqttConnectHandler.java 84.61% <ø> (+84.61%) ⬆️
...mqtt/cs/protocol/mqtt/handler/MqttPingHandler.java 100.00% <ø> (+100.00%) ⬆️
...tt/cs/protocol/mqtt/handler/MqttPubAckHandler.java 87.50% <100.00%> (+87.50%) ⬆️
...t/cs/protocol/mqtt/handler/MqttPubCompHandler.java 100.00% <100.00%> (+100.00%) ⬆️
...tt/cs/protocol/mqtt/handler/MqttPubRecHandler.java 100.00% <100.00%> (+100.00%) ⬆️
...t/cs/protocol/mqtt/handler/MqttPublishHandler.java 93.93% <100.00%> (+93.93%) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c7d6809...a7f2bb1. Read the comment docs.

@Component
public class MqttPubRecHandler implements MqttPacketHandler<MqttMessage> {
private final MqttFixedHeader pubRelMqttFixedHeader = new MqttFixedHeader(MqttMessageType.PUBREL, false,
MqttQoS.AT_LEAST_ONCE, false, 0);
Copy link
Contributor Author

@YxAc YxAc Apr 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make fixHeader as private field to verify the correct 'qosLevel' in PUBREL header for unit test


final boolean isQos2Message = isQos2Message(mqttMessage);
if (isQos2Message && !inFlyCache.contains(InFlyCache.CacheType.PUB, channelId, variableHeader.packetId())) {
inFlyCache.put(InFlyCache.CacheType.PUB, channelId, variableHeader.packetId());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplify the code block

@ShannonDing ShannonDing merged commit 1393642 into apache:main Apr 11, 2022
@YxAc YxAc deleted the part_test_of_mqtt-cs.protocol.mqtt.handler branch April 11, 2022 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants