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

feat: uds 超时优化 #904

Merged
merged 3 commits into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import io.netty.channel.unix.DomainSocketAddress;
import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
import io.netty.handler.codec.LengthFieldPrepender;
import io.netty.util.Timeout;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -166,7 +167,7 @@ public UdsCommand call(UdsCommand req) {
log.debug("start send,id:{}", id);
Send.send(channel, req);

wheelTimer.newTimeout(() -> {
Timeout timeout = wheelTimer.newTimeout(() -> {
log.warn("check async udsClient time out auto close:{},{}", req.getId(), req.getTimeout());
HashMap<String, Object> map = reqMap.remove(req.getId());
if (null != map) {
Expand All @@ -177,7 +178,10 @@ public UdsCommand call(UdsCommand req) {
);
}
}
}, req.getTimeout() + 350);
}, req.getTimeout() + 200);

// 添加完成时取消定时任务的回调
future.whenComplete((k, v) -> timeout.cancel());

//异步还是同步
if (req.isAsync()) {
Expand Down
Loading