This repository has been archived by the owner on Jan 7, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve mongodb connection drop issues (I think).
By switching the mongo connections from the raw Mongo adapter to Mongoose, this seems to fix NREL/api-umbrella#17. Mongoose uses the same underlying mongo driver, so why this fixes it is a bit confusing. My only theories are: - It's related to how Mongoose connects and the keepalive setting. Mongoose doesn't use the newer MongoClient.connect approach, and on a quick glance, there are maybe some differences in how keepalive settings get passed with the new MongoClient.connect). - Or it's Mongoose's query buffering that helps resolve this issue. While we don't need most of Mongoose's extra features, its ability to buffer queries when in a disconnected state might be what fixes this. Assuming this ends up working, the retry logic in api_key_validator.js should be revisited.
- Loading branch information
Showing
17 changed files
with
394 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use strict'; | ||
|
||
var mongoose = require('mongoose'); | ||
|
||
module.exports = mongoose.model('ApiUser', new mongoose.Schema({ | ||
_id: mongoose.Schema.Types.Mixed, | ||
api_key: { | ||
type: String, | ||
index: { unique: true }, | ||
}, | ||
first_name: String, | ||
last_name: String, | ||
email: String, | ||
website: String, | ||
throttle_by_ip: Boolean, | ||
disabled_at: Date, | ||
roles: [String], | ||
settings: mongoose.Schema.Types.Mixed, | ||
}, { collection: 'api_users' })); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict'; | ||
|
||
var mongoose = require('mongoose'); | ||
|
||
module.exports = mongoose.model('ConfigVersion', new mongoose.Schema({ | ||
version: { | ||
type: Date, | ||
unique: true, | ||
}, | ||
config: mongoose.Schema.Types.Mixed, | ||
}, { collection: 'config_versions' })); |
Oops, something went wrong.