diff --git a/src/backends/redis/batch.cpp b/src/backends/redis/batch.cpp index da43256..0d5f6c2 100644 --- a/src/backends/redis/batch.cpp +++ b/src/backends/redis/batch.cpp @@ -133,6 +133,7 @@ namespace redis { } Batch::~Batch() noexcept { + this->reset(); } void Batch::run_pvt (int parArgc, const char** parArgv, std::size_t* parLengths) { @@ -192,6 +193,19 @@ namespace redis { } } + void Batch::reset() noexcept { + try { + this->replies(); //force waiting for any pending jobs + } + catch (...) { + assert(false); + } + + assert(0 == m_local_data->pending_futures); + m_futures.clear(); + m_replies.clear(); + } + RedisError::RedisError (const char* parMessage, std::size_t parLength) : std::runtime_error(std::string(parMessage, parLength)) { diff --git a/src/backends/redis/batch.hpp b/src/backends/redis/batch.hpp index ccced3f..7f8fe69 100644 --- a/src/backends/redis/batch.hpp +++ b/src/backends/redis/batch.hpp @@ -49,6 +49,8 @@ namespace redis { template Batch& operator() ( const char* parCommand, Args&&... parArgs ); + void reset ( void ) noexcept; + private: struct LocalData;