Skip to content

Commit 162fbda

Browse files
authored
Merge pull request #15 from PhilipGough/RHMAP-11065-handle-mongo-restarts
Rhmap 11065 handle mongo restarts
2 parents 96f7c6c + 8969f73 commit 162fbda

File tree

5 files changed

+15
-19
lines changed

5 files changed

+15
-19
lines changed

LICENSE

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -176,18 +176,7 @@
176176

177177
END OF TERMS AND CONDITIONS
178178

179-
APPENDIX: How to apply the Apache License to your work.
180-
181-
To apply the Apache License to your work, attach the following
182-
boilerplate notice, with the fields enclosed by brackets "[]"
183-
replaced with your own identifying information. (Don't include
184-
the brackets!) The text should be enclosed in the appropriate
185-
comment syntax for the file format. We also recommend that a
186-
file or class name and description of purpose be included on the
187-
same "printed page" as the copyright notice for easier
188-
identification within third-party archives.
189-
190-
Copyright [yyyy] [name of copyright owner]
179+
Copyright 2016 Red Hat, Inc.
191180

192181
Licensed under the Apache License, Version 2.0 (the "License");
193182
you may not use this file except in compliance with the License.

lib/fhmongodb.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,20 @@ Database.prototype.tearUp = function (auth) {
153153
if (interval) {
154154
clearInterval(interval);
155155
}
156-
self.db = db.db(self.name);
157-
authenticateUser(auth);
158156

159-
self.db.on('error', function (err) {
160-
console.warn("mongodb emits error: " + err);
157+
db.on('error', function (err) {
158+
console.warn('Mongo connection error:' + err);
161159
self.emit('error', err);
162160
});
161+
162+
db.on('close', function() {
163+
var message = 'Mongo connection closed';
164+
console.warn(message);
165+
self.emit('close', message);
166+
});
167+
168+
self.db = db.db(self.name);
169+
authenticateUser(auth);
163170
}
164171
});
165172
} else {

npm-shrinkwrap.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "fh-db",
33
"description": "FeedHenry Database Library",
4-
"version": "1.2.3",
4+
"version": "1.2.4",
55
"repository": {
66
"type": "git",
77
"url": "git@github.com:feedhenry/fh-db.git"

sonar-project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
sonar.projectKey=fh-db
22
sonar.projectName=fh-db-nightly-master
3-
sonar.projectVersion=1.2.3
3+
sonar.projectVersion=1.2.4
44

55
sonar.sources=./lib
66
sonar.tests=./test

0 commit comments

Comments
 (0)