From 9fe8d5e76fff30d073c775fa058c6d1677e77736 Mon Sep 17 00:00:00 2001 From: Lev Kokotov Date: Wed, 26 Oct 2022 00:14:08 -0700 Subject: [PATCH] Dont change shard unless you know (#195) --- src/query_router.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/query_router.rs b/src/query_router.rs index f65a773..3f8e106 100644 --- a/src/query_router.rs +++ b/src/query_router.rs @@ -335,8 +335,14 @@ impl QueryRouter { // or discard shard selection. If they point to the same shard though, // we can let them through as-is. // This is basically building a database now :) - self.active_shard = self.infer_shard(query); - debug!("Automatically using shard: {:?}", self.active_shard); + match self.infer_shard(query) { + Some(shard) => { + self.active_shard = Some(shard); + debug!("Automatically using shard: {:?}", self.active_shard); + } + + None => (), + }; } None => (),