From 740b0fd0bc514cb6de69370a97366b866e693cb2 Mon Sep 17 00:00:00 2001 From: bojancrevar Date: Fri, 12 Sep 2025 15:25:02 +0200 Subject: [PATCH] dispose references removed --- .gitignore | 1 + bindings/nodejs/README.md | 2 -- bindings/nodejs/src/engine.rs | 12 ------------ bindings/nodejs/src/safe_result.rs | 2 +- bindings/nodejs/test/decision.spec.ts | 4 ---- 5 files changed, 2 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 5f0fbec7..71c7c0ed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store +.temp /target /Cargo.lock diff --git a/bindings/nodejs/README.md b/bindings/nodejs/README.md index 6a2793de..a9041ef5 100644 --- a/bindings/nodejs/README.md +++ b/bindings/nodejs/README.md @@ -40,7 +40,6 @@ import fs from 'fs/promises'; const decision = engine.createDecision(content); const result = await decision.evaluate({ input: 15 }); - engine.dispose(); })(); ``` @@ -59,7 +58,6 @@ const loader = async (key: string) => fs.readFile(path.join(testDataRoot, key))( const engine = new ZenEngine({ loader }); const result = await engine.evaluate('jdm_graph1.json', { input: 5 }); - engine.dispose(); })(); ``` diff --git a/bindings/nodejs/src/engine.rs b/bindings/nodejs/src/engine.rs index 965f6641..2c208ccf 100644 --- a/bindings/nodejs/src/engine.rs +++ b/bindings/nodejs/src/engine.rs @@ -225,16 +225,4 @@ impl ZenEngine { self.get_decision(key).await.into() } - // Function used to dispose memory allocated for loaders - // In the future, it will likely be removed and made automatic - // #[napi] - // pub fn dispose(&self) { - // if let Some(loader) = self.loader_ref { - // let _ = loader.abort(); - // } - // - // if let Some(loader) = self.custom_handler_ref { - // let _ = loader.abort(); - // } - // } } diff --git a/bindings/nodejs/src/safe_result.rs b/bindings/nodejs/src/safe_result.rs index 9c637001..ece9037f 100644 --- a/bindings/nodejs/src/safe_result.rs +++ b/bindings/nodejs/src/safe_result.rs @@ -34,7 +34,7 @@ where } } - Object::to_napi_value(env, obj) //TODO BC ? + Object::to_napi_value(env, obj) } } diff --git a/bindings/nodejs/test/decision.spec.ts b/bindings/nodejs/test/decision.spec.ts index 2222306c..9648a39d 100644 --- a/bindings/nodejs/test/decision.spec.ts +++ b/bindings/nodejs/test/decision.spec.ts @@ -31,7 +31,6 @@ describe('ZenEngine', () => { expect(r2.result.output).toEqual(0); expect(r3.result.output).toEqual(10); - // engine.dispose(); }, 10000); it('Evaluates decisions using getDecision', async () => { @@ -50,7 +49,6 @@ describe('ZenEngine', () => { expect(r2.result.output).toEqual(0); expect(r3.result.output).toEqual(10); - // engine.dispose(); }, 10000); it('Creates a decision from contents', async () => { @@ -86,7 +84,6 @@ describe('ZenEngine', () => { const r = await engine.evaluate('custom.json', { a: 5 }); expect(r.result.data).toEqual(25); - // engine.dispose(); }); it('Parses ZenDecisionContent', async () => { @@ -134,7 +131,6 @@ describe('ZenEngine', () => { } } - // engine.dispose(); }); });