1
0
Fork 0
mirror of https://github.com/KingDuckZ/dindexer.git synced 2024-11-25 00:53:43 +00:00

Add a reset() method to batch.

This commit is contained in:
King_DuckZ 2016-07-11 18:37:47 +01:00
parent 645cf5858b
commit 5566b81b45
2 changed files with 16 additions and 0 deletions

View file

@ -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))
{

View file

@ -49,6 +49,8 @@ namespace redis {
template <typename... Args>
Batch& operator() ( const char* parCommand, Args&&... parArgs );
void reset ( void ) noexcept;
private:
struct LocalData;