Tracked down a bug in a call to MongoDB that failed to ever return. It was trying to remove an index and the call never finished.

This commit is contained in:
2022-08-15 07:01:20 -07:00
parent cf51200393
commit 565ab41f7e
16 changed files with 88 additions and 13 deletions

View File

@@ -2,6 +2,8 @@ import {Meteor} from "meteor/meteor";
import { _ } from 'underscore';
import { Roles } from 'meteor/alanning:roles';
// console.log("Setting Up Admin...")
if (Meteor.isServer) {
Meteor.methods({
'admin.fixRecords'(input) {
@@ -54,3 +56,5 @@ if (Meteor.isServer) {
},
});
}
// console.log("Admin setup.")

View File

@@ -5,6 +5,8 @@ import { Roles } from 'meteor/alanning:roles';
//import SimpleSchema from "simpl-schema";
import {AssetTypes} from "./asset-types";
// console.log("Setting Up Asset Assignments...")
export const AssetAssignments = new Mongo.Collection('assetAssignments');
/*
const TYPE_STUDENT = 1;
@@ -42,8 +44,8 @@ if (Meteor.isServer) {
//try {AssetAssignments._dropIndex("name")} catch(e) {}
//AssetAssignments.createIndex({name: "text"}, {name: "name", unique: false});
try {AssetTypes._dropIndex("AssetID")} catch(e) {} //Typo put this as an index in AssetTypes instead of AssetAssignments.
AssetAssignments.createIndex({assetId: 1}, {name: "AssetID", unique: false});
//try {AssetTypes._dropIndex("AssetID")} catch(e) {} //Typo put this as an index in AssetTypes instead of AssetAssignments.
//AssetAssignments.createIndex({assetId: 1}, {name: "AssetID", unique: false});
// This code only runs on the server
Meteor.publish('assetAssignments', function(assetId) {
@@ -57,11 +59,6 @@ if (Meteor.isServer) {
});
}
Meteor.methods({
'AssetAssignments.getOne'(assetId) {
check(assetId, String);
return AssetAssignments.findOne(assetId);
},
/**
* Assigns the asset to the assignee. The assignee should either be a Student or Staff member.
* @param assetId The Mongo ID of the asset (asset._id).
@@ -91,3 +88,4 @@ Meteor.methods({
},
});
// console.log("Asset assignments setup.")

View File

@@ -4,6 +4,8 @@ import { check } from 'meteor/check';
import { Roles } from 'meteor/alanning:roles';
//import SimpleSchema from "simpl-schema";
// console.log("Setting Up Asset Types...")
//
// An asset type is a specific type of equipment. Example: Lenovo 100e Chromebook.
//
@@ -74,3 +76,4 @@ Meteor.methods({
},
});
// console.log("Asset types setup.")

View File

@@ -7,6 +7,8 @@ import {AssetTypes} from "./asset-types";
import { ReactiveAggregate } from 'meteor/tunguska:reactive-aggregate';
import {AssetAssignments} from "/imports/api/asset-assignments";
// console.log("Setting Up Assets...")
export const Assets = new Mongo.Collection('assets');
/*
@@ -193,3 +195,4 @@ Meteor.methods({
}
});
// console.log("Assets setup.")

View File

@@ -5,6 +5,8 @@ import { MongoClient } from 'mongodb';
import {Assets} from "/imports/api/assets";
//import {Roles} from 'alanning/roles';
// console.log("Setting Up Data Collection...")
//export const Records = new Mongo.Collection('records');
let client;
let database;
@@ -104,3 +106,5 @@ if (Meteor.isServer) {
// },
});
}
// console.log("Data Collection setup.")

View File

@@ -7,3 +7,5 @@ import "./sites.js";
import "./asset-types.js";
import "./assets.js";
import "./asset-assignments.js";
// console.log("Finished setting up server side models.");

View File

@@ -4,6 +4,8 @@ import {Students} from "./students";
import {Staff} from "./staff";
import { Roles } from 'meteor/alanning:roles';
// console.log("Setting Up Sites...")
export const Sites = new Mongo.Collection('sites');
if (Meteor.isServer) {
@@ -36,3 +38,5 @@ Meteor.methods({
}
},
});
// console.log("Sites setup.")

View File

@@ -6,6 +6,8 @@ import {Sites} from "/imports/api/sites";
import {parse} from "csv-parse";
import { ReactiveAggregate } from 'meteor/tunguska:reactive-aggregate';
// console.log("Setting Up Staff...")
export const Staff = new Mongo.Collection('staff');
if (Meteor.isServer) {
@@ -160,3 +162,4 @@ Meteor.methods({
}
});
// console.log("Staff setup.")

View File

@@ -6,6 +6,8 @@ import { Roles } from 'meteor/alanning:roles';
import {parse} from 'csv-parse';
import { ReactiveAggregate } from 'meteor/tunguska:reactive-aggregate';
// console.log("Setting Up Students...")
export const Students = new Mongo.Collection('students');
if (Meteor.isServer) {
@@ -171,3 +173,5 @@ if (Meteor.isServer) {
});
}
// console.log("Students setup.")

View File

@@ -2,6 +2,8 @@ import { Meteor } from 'meteor/meteor';
import { Roles } from 'meteor/alanning:roles';
import { check } from 'meteor/check';
// console.log("Setting Up Users...")
if (Meteor.isServer) {
Meteor.publish(null, function() {
if(this.userId) {
@@ -66,3 +68,5 @@ if (Meteor.isServer) {
// },
});
}
// console.log("Users setup.")

View File

@@ -2,6 +2,8 @@ import { Accounts } from 'meteor/accounts-base'
import { Roles } from 'meteor/alanning:roles'
import {Meteor} from "meteor/meteor";
console.log("Setting up accounts-config...")
if(Meteor.isClient) {
Accounts.ui.config({
passwordSignupFields: 'USERNAME_ONLY'
@@ -68,3 +70,5 @@ if(Meteor.isServer) {
});
}
}
console.log("Finished setting up accounts-config.")

26
package-lock.json generated
View File

@@ -3148,6 +3148,22 @@
"node": ">=0.10.0"
}
},
"node_modules/rollup": {
"version": "2.78.0",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.78.0.tgz",
"integrity": "sha512-4+YfbQC9QEVvKTanHhIAFVUFSRsezvQF8vFOJwtGfb9Bb+r014S+qryr9PSmw8x6sMnPkmFBGAvIFVQxvJxjtg==",
"dev": true,
"peer": true,
"bin": {
"rollup": "dist/bin/rollup"
},
"engines": {
"node": ">=10.0.0"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
}
},
"node_modules/rollup-plugin-css-only": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/rollup-plugin-css-only/-/rollup-plugin-css-only-3.1.0.tgz",
@@ -6171,6 +6187,16 @@
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
"integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q=="
},
"rollup": {
"version": "2.78.0",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.78.0.tgz",
"integrity": "sha512-4+YfbQC9QEVvKTanHhIAFVUFSRsezvQF8vFOJwtGfb9Bb+r014S+qryr9PSmw8x6sMnPkmFBGAvIFVQxvJxjtg==",
"dev": true,
"peer": true,
"requires": {
"fsevents": "~2.3.2"
}
},
"rollup-plugin-css-only": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/rollup-plugin-css-only/-/rollup-plugin-css-only-3.1.0.tgz",

View File

@@ -1,10 +1,12 @@
console.log("Checking Environment...");
if(!process.env.MONGO_URL) {
console.log("Must provide the MONGO_URL environment variable point to the district central's main database. Should be of the format: `mongodb://localhost:27017/DatabaseName` or `mongodb://user_name:password@host.domain.com,host2.domain.com,host3.domain.com/DatabaseName?replicaSet=set_name`.")
console.error("Must provide the MONGO_URL environment variable point to the district central's main database. Should be of the format: `mongodb://localhost:27017/DatabaseName` or `mongodb://user_name:password@host.domain.com,host2.domain.com,host3.domain.com/DatabaseName?replicaSet=set_name`.")
process.exit(0);
}
if(!process.env.MONGO_URL2) {
console.log("Must provide the MONGO_URL2 environment variable pointing to the chromebook data collection dataset. Should be of the format: `mongodb://localhost:27017/DatabaseName` or `mongodb://user_name:password@host.domain.com,host2.domain.com,host3.domain.com/DatabaseName?replicaSet=set_name`.")
console.error("Must provide the MONGO_URL2 environment variable pointing to the chromebook data collection dataset. Should be of the format: `mongodb://localhost:27017/DatabaseName` or `mongodb://user_name:password@host.domain.com,host2.domain.com,host3.domain.com/DatabaseName?replicaSet=set_name`.")
process.exit(0);
}
@@ -12,8 +14,8 @@ try {
let settings = Assets.getText('settings.json');
}
catch(e) {
console.log("Must have a /private/settings.json file with the following format:");
console.log(`
console.error("Must have a /private/settings.json file with the following format:");
console.error(`
{
"google": {
"clientId": "xxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com",
@@ -30,3 +32,5 @@ catch(e) {
`);
process.exit(0);
}
console.log("Environment Checking Complete.")

View File

@@ -1,6 +1,8 @@
import {MongoInternals} from 'meteor/mongo';
import {Meteor} from 'meteor/meteor';
console.log("Setting up data collection database connection...");
let uri = process.env.MONGO_URL2; //"mongodb://localhost:27017/avusd_data_collection";
//uri = "mongodb://localhost:27017/avusd_data_collection";
//console.log(uri);
@@ -11,3 +13,5 @@ Meteor.Records = collection;
// let results = collection.find({deviceId: "1e3e99ef-adf4-4aa2-8784-205bc60f0ce3"}).fetch();
// console.log(results);
console.log("Database connection setup.")

View File

@@ -4,6 +4,8 @@
* Loads the information from the /private/settings.json file.
*/
console.log("Setting up Google OAuth...");
try {
let settings = Assets.getText('settings.json');
@@ -48,3 +50,5 @@ ServiceConfiguration.configurations.upsert(
}
);
*/
console.log("Finished OAuth setup.")

View File

@@ -3,6 +3,8 @@ import winston from "winston";
import moment from "moment";
import _ from 'underscore';
// console.log("Setting up logging....");
let production = (process.env.NODE_ENV === "production");
let logPath = process.env.LOG_PATH;
@@ -88,3 +90,5 @@ console.warn = function(d) {
console.error = function(e) {
logger.log("error", e.stack || e);
}
// console.log("Logger setup.");