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

异步路由是否需要返回结果? #2

Open
nadirvishun opened this issue Aug 26, 2022 · 0 comments
Open

异步路由是否需要返回结果? #2

nadirvishun opened this issue Aug 26, 2022 · 0 comments

Comments

@nadirvishun
Copy link

nadirvishun commented Aug 26, 2022

下方的代码都调用了future.get()方法来阻塞获取结果,但实际上有必要吗?万一我们的其中一个异步处理超过了钉钉规定的1500ms响应时间,那异步的作用就不是很大,仅仅是多个回调之间会并行,我看wxjava中之所以调用是因为它要结束session调用sessionEndAccess方法,而钉钉的没有这些,是否有必要管异步路由的结果?

if (futures.size() > 0) {
this.executorService.submit(() -> {
for (Future<Boolean> future : futures) {
try {
future.get();
} catch (InterruptedException e) {
log.error("Error happened when wait task finish", e);
Thread.currentThread().interrupt();
} catch (ExecutionException e) {
log.error("Error happened when wait task finish", e);
}
}
});
}


又考虑了下,如果全部设置成异步不判定结果都返回true的也有个麻烦,就是如果异步失败的话需要自己记录失败,而无法仅仅通过获取推送失败的事件列表这个接口来获取全部失败的推送,需要加上自己记录的失败才是全部的失败记录。

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

No branches or pull requests

1 participant