Open
Description
Describe the problem
I have the code which is called in a loop and I need to use the connection pool every iteration. If the single iteration does not finish within the specified time span I need to abandon the results and I'm not sure how to do that.
pipeline destructor returns the connection to the pool, but in the next iteration I get an error with access violation. I cannot use discard as it also results in access violation.
Is there a safe way how to abandon the in-progress commands on connections from the connection pool?
std::future<void> task;
{
auto pipeline{ _redis->pipeline(false) };
task = std::async(std::launch::async, [&]() {
// filling the pipe with data
pipeline.set(...);
auto replies{ pipeline.exec() };
});
if (const auto status{ task.wait_for(std::chrono::milliseconds(500)) };
status == std::future_status::timeout) {
// abandon the pipeline if it didn't finish within the required time span
//pipeline.discard();
}
}
Environment:
- OS: Windows 11
- Compiler: Visual Studio MSVC Version 17.10.4
- hiredis version: v1.2.0
- redis-plus-plus version: 1.3.12
Metadata
Metadata
Assignees
Labels
No labels