From 4f79a7378981406f08c6b8d9d1ec2f1e4e853d22 Mon Sep 17 00:00:00 2001 From: Dief Bell Date: Fri, 15 Nov 2024 15:09:00 +0000 Subject: [PATCH 1/5] Added workflow_dispatch to master --- .github/workflows/CI.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7c494919..5a1a5536 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,5 +1,6 @@ name: CI on: + workflow_dispatch: pull_request: push: branches: From 65f44b9ee55c9beccdbe54f0f6d70a7db5066535 Mon Sep 17 00:00:00 2001 From: Dief Bell Date: Wed, 20 Nov 2024 14:04:09 +0000 Subject: [PATCH 2/5] Persist default zqm Context across Chromium contexts --- src/context.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/context.cc b/src/context.cc index 91d1970a..fc8b8b49 100644 --- a/src/context.cc +++ b/src/context.cc @@ -170,10 +170,14 @@ void Context::Initialize(Module& module, Napi::Object& exports) { auto constructor = DefineClass(exports.Env(), "Context", proto, &module); - /* Create global context that is closed on process exit. */ - auto context = constructor.New({}); - module.GlobalContext = Napi::Persistent(context); - exports.Set("context", context); + // Check if GlobalContext already exists and if it's tied to the current environment + if (!module.GlobalContext.Env() || module.GlobalContext.Env() != exports.Env()) { + // Create the context and store the persistent reference if not already created + auto context = constructor.New({}); + module.GlobalContext = Napi::Persistent(context); + } + + exports.Set("context", module.GlobalContext.Value()); module.Context = Napi::Persistent(constructor); exports.Set("Context", constructor); From 8e1c4c9ee9537105a5f0e44020c60ec1682c8b91 Mon Sep 17 00:00:00 2001 From: Dief Bell Date: Wed, 20 Nov 2024 14:22:42 +0000 Subject: [PATCH 3/5] Not recreating in every context, checking if empty --- src/context.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/context.cc b/src/context.cc index fc8b8b49..92d4ced8 100644 --- a/src/context.cc +++ b/src/context.cc @@ -171,7 +171,7 @@ void Context::Initialize(Module& module, Napi::Object& exports) { auto constructor = DefineClass(exports.Env(), "Context", proto, &module); // Check if GlobalContext already exists and if it's tied to the current environment - if (!module.GlobalContext.Env() || module.GlobalContext.Env() != exports.Env()) { + if (module.GlobalContext.IsEmpty()) { // Create the context and store the persistent reference if not already created auto context = constructor.New({}); module.GlobalContext = Napi::Persistent(context); From e2f3e8ea7711f3eb2f1103a878a5e4b5cc35ee19 Mon Sep 17 00:00:00 2001 From: Dief Bell Date: Wed, 20 Nov 2024 14:23:03 +0000 Subject: [PATCH 4/5] Bumped version number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3b15f457..881daac5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zeromq", - "version": "6.1.2", + "version": "6.2.0", "description": "Next-generation ZeroMQ bindings for Node.js", "main": "lib/index.js", "type": "commonjs", From 445b4c945f0b89a781b0cc9fea34ba7ae57b58c6 Mon Sep 17 00:00:00 2001 From: Dief Bell Date: Wed, 20 Nov 2024 14:28:36 +0000 Subject: [PATCH 5/5] Removed the workflow_dispatch trigger for CI --- .github/workflows/CI.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 54ff133a..da8c0526 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,6 +1,5 @@ name: CI on: - workflow_dispatch: pull_request: push: branches: