remove bindEnvironment from code hotspots

This commit is contained in:
Leonardo Venturini
2024-10-08 14:57:21 -04:00
parent f5974a8e74
commit 505f112505
2 changed files with 2 additions and 25 deletions

View File

@@ -133,10 +133,7 @@ Object.assign(AsynchronousQueue.prototype, {
);
const handle = {
task: Meteor.bindEnvironment(task, function (e) {
Meteor._debug('Exception from task', e);
throw e;
}),
task,
name: task.name,
resolver,
};

View File

@@ -338,10 +338,6 @@ var writeCallback = function (write, refresh, callback) {
};
};
var bindEnvironmentForWrite = function (callback) {
return Meteor.bindEnvironment(callback, "Mongo write");
};
MongoConnection.prototype.insertAsync = async function (collection_name, document) {
const self = this;
@@ -967,24 +963,8 @@ Cursor.prototype.observeAsync = function (callbacks) {
Cursor.prototype.observeChanges = function (callbacks, options = {}) {
var self = this;
var methods = [
'addedAt',
'added',
'changedAt',
'changed',
'removedAt',
'removed',
'movedTo'
];
var ordered = LocalCollection._observeChangesCallbacksAreOrdered(callbacks);
let exceptionName = callbacks._fromObserve ? 'observe' : 'observeChanges';
exceptionName += ' callback';
methods.forEach(function (method) {
if (callbacks[method] && typeof callbacks[method] == "function") {
callbacks[method] = Meteor.bindEnvironment(callbacks[method], method + exceptionName);
}
});
var ordered = LocalCollection._observeChangesCallbacksAreOrdered(callbacks);
return self._mongo._observeChanges(
self._cursorDescription, ordered, callbacks, options.nonMutatingCallbacks);