Fixed no-op bulk writes
This commit is contained in:
@@ -8,7 +8,6 @@ import Creatures from "/imports/api/creature/Creatures.js";
|
|||||||
import CreatureProperties from "/imports/api/creature/CreatureProperties.js";
|
import CreatureProperties from "/imports/api/creature/CreatureProperties.js";
|
||||||
import * as math from 'mathjs';
|
import * as math from 'mathjs';
|
||||||
import parser from '/imports/parser/parser.js';
|
import parser from '/imports/parser/parser.js';
|
||||||
if (Meteor.isClient) console.log({parser});
|
|
||||||
|
|
||||||
export const recomputeCreature = new ValidatedMethod({
|
export const recomputeCreature = new ValidatedMethod({
|
||||||
|
|
||||||
@@ -19,7 +18,6 @@ export const recomputeCreature = new ValidatedMethod({
|
|||||||
}).validator(),
|
}).validator(),
|
||||||
|
|
||||||
run({charId}) {
|
run({charId}) {
|
||||||
console.log(`recomputing ${charId}`)
|
|
||||||
// Permission
|
// Permission
|
||||||
assertEditPermission(charId, this.userId);
|
assertEditPermission(charId, this.userId);
|
||||||
// Work, call this direcly if you are already in a method that has checked
|
// Work, call this direcly if you are already in a method that has checked
|
||||||
@@ -122,9 +120,10 @@ function writeAttributes(char) {
|
|||||||
}
|
}
|
||||||
return op;
|
return op;
|
||||||
});
|
});
|
||||||
|
if (!bulkWriteOps.length) return;
|
||||||
if (Meteor.isServer){
|
if (Meteor.isServer){
|
||||||
CreatureProperties.rawCollection().bulkWrite(bulkWriteOps, {ordered : false}, function(e, r){
|
let result = CreatureProperties.rawCollection().bulkWrite(bulkWriteOps, {ordered : false}, function(e, r){
|
||||||
if (e) console.warn(JSON.stringify(e, null, 2));
|
if (e) console.error(e);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
_.each(bulkWriteOps, op => {
|
_.each(bulkWriteOps, op => {
|
||||||
@@ -145,9 +144,10 @@ function writeEffects(char){
|
|||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
if (!bulkWriteOps.length) return;
|
||||||
if (Meteor.isServer){
|
if (Meteor.isServer){
|
||||||
CreatureProperties.rawCollection().bulkWrite(bulkWriteOps, {ordered : false}, function(e, r){
|
let result = CreatureProperties.rawCollection().bulkWrite(bulkWriteOps, {ordered : false}, function(e, r){
|
||||||
if (e) console.warn(JSON.stringify(e, null, 2));
|
if (e) console.error(e);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
_.each(bulkWriteOps, op => {
|
_.each(bulkWriteOps, op => {
|
||||||
@@ -181,9 +181,10 @@ function writeSkills(char) {
|
|||||||
};
|
};
|
||||||
return op;
|
return op;
|
||||||
});
|
});
|
||||||
|
if (!bulkWriteOps.length) return;
|
||||||
if (Meteor.isServer){
|
if (Meteor.isServer){
|
||||||
CreatureProperties.rawCollection().bulkWrite( bulkWriteOps, {ordered : false}, function(e, r){
|
let result = CreatureProperties.rawCollection().bulkWrite( bulkWriteOps, {ordered : false}, function(e, r){
|
||||||
if (e) console.warn(JSON.stringify(e, null, 2));
|
if (e) console.error(e);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
_.each(bulkWriteOps, op => {
|
_.each(bulkWriteOps, op => {
|
||||||
@@ -213,9 +214,10 @@ function writeDamageMultipliers(char) {
|
|||||||
};
|
};
|
||||||
return op;
|
return op;
|
||||||
});
|
});
|
||||||
|
if (!bulkWriteOps.length) return;
|
||||||
if (Meteor.isServer){
|
if (Meteor.isServer){
|
||||||
CreatureProperties.rawCollection().bulkWrite( bulkWriteOps, {ordered : false}, function(e, r){
|
let result = CreatureProperties.rawCollection().bulkWrite( bulkWriteOps, {ordered : false}, function(e, r){
|
||||||
if (e) console.warn(JSON.stringify(e, null, 2));
|
if (e) console.error(e);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
_.each(bulkWriteOps, op => {
|
_.each(bulkWriteOps, op => {
|
||||||
|
|||||||
Reference in New Issue
Block a user