Closed omar-mohamed-khallaf closed 2 years ago
Does the filter support async?
auto redisClientPtr = app().getRedisClient();
transPtr->execCommandAsync(
[fccb](const nosql::RedisResult &r) {
// successed
return fccb();
},
[](const std::exception &err) { /* this command failed */ },
"del %s", auth.data());
I have tested in my project and it seems that only synchronous methods can be used.
Does the filter support async?
auto redisClientPtr = app().getRedisClient(); transPtr->execCommandAsync( [fccb](const nosql::RedisResult &r) { // successed return fccb(); }, [](const std::exception &err) { /* this command failed */ }, "del %s", auth.data());
I have tested in my project and it seems that only synchronous methods can be used.
@1111mp It does, but the filter chain callback must be running on the IO threads due to some implementation details. So you can only use fast RedisClient or fast DbClient here.
Is your feature request related to a problem? Please describe. Executing queries in
HttpFilter
specially for redis becomes messy because of the callbacks and dependency between the queries:Describe the solution you'd like Add coroutines support for
HttpFilter::doFilter
method.Additional context Example: