apache / apache/apisix-java-plugin-runner

bug: Why write confToken twice when writing back to API SIX

未關閉
#320 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Java
星號
152
分支
102
PR 合併指標
30 天內沒有已合併 PR

描述

### Issue description
Why write confToken twice when writing back to API SIX

### Environment
jdk11

* your apisix-java-plugin-runner version
0.5
### Minimal test code / Steps to reproduce the issue
protected void channelRead0(ChannelHandlerContext ctx, A6Request request) {
if (request.getType() != Constants.RPC_PREPARE_CONF) {
ctx.fireChannelRead(request);
return;
}

Req req = ((A6ConfigRequest) request).getReq();
long confToken = ThreadLocalRandom.current().nextInt(Integer.MAX_VALUE);
A6Response response = new A6ConfigResponse(confToken);
long token = ((A6ConfigResponse) response).getConfToken();
PluginFilterChain chain = createFilterChain(req);

/*
* to reset vtable_start and vtable_size of req,
* so that req can be reused after being got from the cache.
* {@link org.apache.apisix.plugin.runner.handler.A6HttpCallHandler#handle cache.getIfPresent()}
* @see https://github.com/apache/apisix-java-plugin-runner/issues/63
* */
Map config = new HashMap<>();
for (int i = 0; i < req.confLength(); i++) {
TextEntry conf = req.conf(i);
config.put(conf.name(), conf.value());
}
A6Conf a6Conf = new A6Conf(config, chain);
cache.put(token, a6Conf);
for (A6ConfigWatcher watcher : watchers) {
watcher.watch(token, a6Conf);
}
ctx.write(response);
ctx.writeAndFlush(response);
}

### What's the actual result? (including assertion message & call stack if applicable)

### What's the expected result?

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。