Created
July 29, 2016 03:41
-
-
Save tjdavey/20afd01e866465c652e80c66a2f39bd8 to your computer and use it in GitHub Desktop.
Couchbase SDK Reconnection Test
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
'use strict'; | |
var couchbase = require('couchbase'); | |
var HOST = 'couchbase://192.168.15.223'; | |
var BUCKET = 'test'; | |
var KEY = 'test_key'; | |
var TEST_INTERVAL = 500; | |
var cluster = new couchbase.Cluster(HOST); | |
var bucket = cluster.openBucket(BUCKET); | |
var testCount = 0; | |
bucket.on('error', function (err) { | |
console.log('Couchbase Error', err); | |
}); | |
bucket.on('connect', function () { | |
console.log('Couchbase Connected'); | |
}); | |
function getTest() { | |
var thisCount = testCount; | |
bucket.get(KEY, function (error, result) { | |
if(result && !error){ | |
console.log(thisCount + " SUCCESS"); | |
} else { | |
console.log(thisCount + " FAILURE", error); | |
} | |
}); | |
testCount++; | |
} | |
setInterval(getTest, TEST_INTERVAL); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment