From dbd591a741033ac0379f7c4281ebb972a0837857 Mon Sep 17 00:00:00 2001 From: Roman Dmytrenko Date: Wed, 27 Mar 2024 18:45:05 +0200 Subject: [PATCH] fix(ffi): prevent fatal error if there is the connection error during client creation --- flipt-engine-ffi/src/evaluator/mod.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/flipt-engine-ffi/src/evaluator/mod.rs b/flipt-engine-ffi/src/evaluator/mod.rs index b0ca2fb7..75522b94 100644 --- a/flipt-engine-ffi/src/evaluator/mod.rs +++ b/flipt-engine-ffi/src/evaluator/mod.rs @@ -26,9 +26,10 @@ where P: Parser + Send, { pub fn new_snapshot_evaluator(namespace: &str, parser: P) -> Result { - let doc = parser.parse(namespace)?; - let snap = Snapshot::build(namespace, doc)?; - Ok(Evaluator::new(namespace, parser, snap)) + let snap = Snapshot::build(namespace, Document::default())?; + let mut e = Evaluator::new(namespace, parser, snap); + e.replace_snapshot(); + Ok(e) } pub fn replace_snapshot(&mut self) {