-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AerospikeError: Not connected. after server restart #6
Comments
Sorry for the late response. I was busy with other projects. The client should automatically reconnect to the cluster once it comes back up. If the cluster goes down while your express app is running, you should see one of these two errors:
You could get the error Here is the simple demo app I was using for testing: $ cat express.js
const express = require('express')
const session = require('express-session')
const AerospikeStore = require('aerospike-session-store')(session)
var app = express()
app.use(session({
secret: '123456789QWERTY',
store: new AerospikeStore({
namespace: 'express',
set: 'session',
ttl: 86400, // 1 day
hosts: process.env.AEROSPIKE_HOSTS
}),
resave: false,
saveUninitialized: false
}))
app.get('/', (req, res) => {
var sess = req.session
if (sess.views) {
sess.views++
res.setHeader('Content-Type', 'text/html')
res.write('<p>views: ' + sess.views + '</p>')
res.end()
} else {
console.log('initializing new session')
sess.views = 1
res.end('welcome to the session demo. refresh!')
}
console.log('views=', sess.views)
})
app.listen(3000, () => {
console.log('Session store example listening at http://localhost:3000/')
}) I start this app, hit the root path a few times in the browser and then shut down the Aerospike server. When reloading the page, the error I see is
|
It looks like if the connection between the server gets interrupted or the server restarts, the connection is never re-established.
To reproduce this
To fix this you need to restart the node process which is very inconvenient. it would be much better if the client library detects this and reconnects.
The text was updated successfully, but these errors were encountered: