mirror of
https://github.com/KingDuckZ/dindexer.git
synced 2025-07-03 14:14:11 +00:00
Bugfix - cope with empty scan replies.
And, don't assert if anybody tries to disconnect twice. Just do nothing.
This commit is contained in:
parent
4b0aa85ac2
commit
d10ae6846d
2 changed files with 9 additions and 7 deletions
|
@ -172,6 +172,8 @@ namespace redis {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsyncConnection::disconnect() {
|
void AsyncConnection::disconnect() {
|
||||||
|
if (not m_local_data->connect_processed)
|
||||||
|
return;
|
||||||
assert(m_local_data->redis_poll_thread.joinable());
|
assert(m_local_data->redis_poll_thread.joinable());
|
||||||
m_local_data->connect_processed = false;
|
m_local_data->connect_processed = false;
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,16 +82,16 @@ namespace redis {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::vector<Reply> array_reply;
|
std::vector<Reply> array_reply;
|
||||||
long long new_context;
|
long long new_context = m_scan_context;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
auto whole_reply = this->forward_scan_command<ValueFetch>(0);
|
auto whole_reply = this->forward_scan_command<ValueFetch>(new_context);
|
||||||
|
|
||||||
array_reply = get_array(whole_reply);
|
array_reply = get_array(whole_reply);
|
||||||
assert(2 == array_reply.size());
|
assert(2 == array_reply.size());
|
||||||
assert(array_reply.size() % ValueFetch::step == 0);
|
assert(array_reply.size() % ValueFetch::step == 0);
|
||||||
new_context = get_integer_autoconv_if_str(array_reply[0]);
|
new_context = get_integer_autoconv_if_str(array_reply[0]);
|
||||||
} while (new_context and array_reply.empty());
|
} while (new_context and get_array(array_reply[1]).empty());
|
||||||
|
|
||||||
const auto variant_array = get_array(array_reply[1]);
|
const auto variant_array = get_array(array_reply[1]);
|
||||||
assert(variant_array.size() % ValueFetch::step == 0);
|
assert(variant_array.size() % ValueFetch::step == 0);
|
||||||
|
@ -131,14 +131,14 @@ namespace redis {
|
||||||
|
|
||||||
template <typename ValueFetch>
|
template <typename ValueFetch>
|
||||||
template <typename T>
|
template <typename T>
|
||||||
Reply ScanIterator<ValueFetch>::forward_scan_command (typename std::enable_if<HasScanTargetMethod<T>::value, int>::type) {
|
Reply ScanIterator<ValueFetch>::forward_scan_command (typename std::enable_if<HasScanTargetMethod<T>::value, long long>::type parContext) {
|
||||||
return implem::ScanIteratorBaseClass::run(T::command(), T::scan_target(), m_scan_context, T::work_count);
|
return implem::ScanIteratorBaseClass::run(T::command(), T::scan_target(), parContext, T::work_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ValueFetch>
|
template <typename ValueFetch>
|
||||||
template <typename T>
|
template <typename T>
|
||||||
Reply ScanIterator<ValueFetch>::forward_scan_command (typename std::enable_if<not HasScanTargetMethod<T>::value, int>::type) {
|
Reply ScanIterator<ValueFetch>::forward_scan_command (typename std::enable_if<not HasScanTargetMethod<T>::value, long long>::type parContext) {
|
||||||
return implem::ScanIteratorBaseClass::run(T::command(), m_scan_context, T::work_count);
|
return implem::ScanIteratorBaseClass::run(T::command(), parContext, T::work_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue