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

Forgot to wait for batch to complete.

And batch was declared in the wrong place anyways -_-
This commit is contained in:
King_DuckZ 2016-07-10 14:07:15 +01:00
parent 77fb699ec2
commit 3d7632ef2c

View file

@ -60,12 +60,13 @@ namespace dindb {
void tag_files (redis::Command& parRedis, redis::Script& parTagIfInSet, const std::vector<std::string>& parRegexes, const std::vector<boost::string_ref>& parTags, GroupIDType parSet) { void tag_files (redis::Command& parRedis, redis::Script& parTagIfInSet, const std::vector<std::string>& parRegexes, const std::vector<boost::string_ref>& parTags, GroupIDType parSet) {
using dinhelp::lexical_cast; using dinhelp::lexical_cast;
auto batch = parRedis.make_batch();
const std::string set_key = (parSet != InvalidGroupID ? PROGRAM_NAME ":set:" + lexical_cast<std::string>(parSet) : ""); const std::string set_key = (parSet != InvalidGroupID ? PROGRAM_NAME ":set:" + lexical_cast<std::string>(parSet) : "");
const auto regexes = compile_regexes(parRegexes); const auto regexes = compile_regexes(parRegexes);
for (const auto& itm : parRedis.scan(PROGRAM_NAME ":file:*")) { for (const auto& itm : parRedis.scan(PROGRAM_NAME ":file:*")) {
const auto& file_key = itm; const auto& file_key = itm;
const auto path = redis::get_string(parRedis.run("HGET", file_key, "path")); const auto path = redis::get_string(parRedis.run("HGET", file_key, "path"));
auto batch = parRedis.make_batch();
for (const auto& regex : regexes) { for (const auto& regex : regexes) {
if (not std::regex_search(path, regex)) if (not std::regex_search(path, regex))
continue; continue;
@ -77,6 +78,7 @@ namespace dindb {
parTagIfInSet.run(batch, std::make_tuple(tag_key, file_key), std::make_tuple(set_key)); parTagIfInSet.run(batch, std::make_tuple(tag_key, file_key), std::make_tuple(set_key));
} }
} }
batch.throw_if_failed();
} }
} }