From cb768eeb92a259d3b862102ce8f2a0628cc2a635 Mon Sep 17 00:00:00 2001 From: Gabriel Grubba Date: Wed, 3 May 2023 10:33:13 -0300 Subject: [PATCH] Revert "removed fiber context" This reverts commit c16b693ff4ab393bc173d6c5974224a9a147afbf. --- packages/meteor/dynamics_nodejs.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/meteor/dynamics_nodejs.js b/packages/meteor/dynamics_nodejs.js index 39647511a1..4023daedb3 100644 --- a/packages/meteor/dynamics_nodejs.js +++ b/packages/meteor/dynamics_nodejs.js @@ -99,6 +99,29 @@ class EnvironmentVariableAsync { */ Meteor.EnvironmentVariable = EnvironmentVariableAsync; +EVp._set = function (context) { + Meteor._nodeCodeMustBeInFiber(); + Fiber.current._meteor_dynamics[this.slot] = context; +}; + +EVp._setNewContextAndGetCurrent = function (value) { + Meteor._nodeCodeMustBeInFiber(); + if (!Fiber.current._meteor_dynamics) { + Fiber.current._meteor_dynamics = []; + } + const saved = Fiber.current._meteor_dynamics[this.slot]; + this._set(value); + return saved; +}; + +EVp._isCallAsyncMethodRunning = function () { + return callAsyncMethodRunning; +}; + +EVp._setCallAsyncMethodRunning = function (value) { + callAsyncMethodRunning = value; +}; + // Meteor application code is always supposed to be run inside a // fiber. bindEnvironment ensures that the function it wraps is run from