Skip to content

Commit

Permalink
Merge pull request OpenUserJS#851 from Martii/tryMongoDBdifferentValues
Browse files Browse the repository at this point in the history
Change some defaults with MongoDB and stderr

Auto-merge
  • Loading branch information
Martii committed Dec 16, 2015
2 parents a18c315 + bb16868 commit 1588b40
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
25 changes: 22 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,32 @@ var settings = require('./models/settings.json');
var connectStr = process.env.CONNECT_STRING || settings.connect;
var sessionSecret = process.env.SESSION_SECRET || settings.secret;
var db = mongoose.connection;

var dbOptions = {
server: {
poolSize: 5,
socketOptions: {
keepAlive: 1
autoReconnect: false,
noDelay: true,
keepAlive: 1,
connectTimeoutMS: 0,
socketTimeoutMS: 0
},
reconnectTries: 60,
reconnectInterval: 4000
reconnectTries: 30,
reconnectInterval: 1000
}
};

if (isPro) {
dbOptions.replset = {
secondaryAcceptableLatencyMS: 15,
poolSize: 5,
socketOptions: {
noDelay: true,
keepAlive: 0,
connectTimeoutMS: 0,
socketTimeoutMS: 0
}
}
};

Expand Down
7 changes: 5 additions & 2 deletions controllers/scriptStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,16 @@ exports.getSource = function (aReq, aCallback) {

if (!aScript) {
aCallback(null);
console.warn('no script found' );
if (isDbg) {
console.warn('no script found yet' );
}
return;
}

s3Object = s3.getObject({ Bucket: bucketName, Key: installNameBase + (isLib ? '.js' : '.user.js') }).createReadStream().
on('error', function () {
if (isPro) {
// TODO: #486
if (isDbg) {
console.error('S3 Key Not Found ' + installNameBase + (isLib ? '.js' : '.user.js'));
}

Expand Down

0 comments on commit 1588b40

Please sign in to comment.