From 3d7632ef2cfe07f1ffa7d3a1f4bc61c47f052ef7 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Sun, 10 Jul 2016 14:07:15 +0100 Subject: [PATCH] Forgot to wait for batch to complete. And batch was declared in the wrong place anyways -_- --- src/backends/redis/tag.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/backends/redis/tag.cpp b/src/backends/redis/tag.cpp index dfcfa35..e9d8d2d 100644 --- a/src/backends/redis/tag.cpp +++ b/src/backends/redis/tag.cpp @@ -60,12 +60,13 @@ namespace dindb { void tag_files (redis::Command& parRedis, redis::Script& parTagIfInSet, const std::vector& parRegexes, const std::vector& parTags, GroupIDType parSet) { using dinhelp::lexical_cast; - auto batch = parRedis.make_batch(); const std::string set_key = (parSet != InvalidGroupID ? PROGRAM_NAME ":set:" + lexical_cast(parSet) : ""); const auto regexes = compile_regexes(parRegexes); for (const auto& itm : parRedis.scan(PROGRAM_NAME ":file:*")) { const auto& file_key = itm; const auto path = redis::get_string(parRedis.run("HGET", file_key, "path")); + + auto batch = parRedis.make_batch(); for (const auto& regex : regexes) { if (not std::regex_search(path, regex)) continue; @@ -77,6 +78,7 @@ namespace dindb { parTagIfInSet.run(batch, std::make_tuple(tag_key, file_key), std::make_tuple(set_key)); } } + batch.throw_if_failed(); } }