Loading lib/document_stores/postgres.js +12 −8 Original line number Diff line number Diff line /*global require,module,process*/ var postgres = require('pg'); var winston = require('winston'); const {Client} = require('pg'); // create table entries (id serial primary key, key varchar(255) not null, value text not null, expiration int, unique(key)); Loading Loading @@ -64,13 +64,17 @@ PostgresDocumentStore.prototype = { // A connection wrapper safeConnect: function (callback) { postgres.connect(this.connectionUrl, function (err, client, done) { if (err) { winston.error('error connecting to postgres', { error: err }); callback(err); } else { const client = new Client({connectionString: this.connectionUrl}); const connectionPromise = client.connect(); const done = () => {}; connectionPromise.then(() => { callback(undefined, client, done); } }).catch((error) => { console.log(error); winston.error('error connecting to postgres', {error}); callback(error); }); } Loading Loading
lib/document_stores/postgres.js +12 −8 Original line number Diff line number Diff line /*global require,module,process*/ var postgres = require('pg'); var winston = require('winston'); const {Client} = require('pg'); // create table entries (id serial primary key, key varchar(255) not null, value text not null, expiration int, unique(key)); Loading Loading @@ -64,13 +64,17 @@ PostgresDocumentStore.prototype = { // A connection wrapper safeConnect: function (callback) { postgres.connect(this.connectionUrl, function (err, client, done) { if (err) { winston.error('error connecting to postgres', { error: err }); callback(err); } else { const client = new Client({connectionString: this.connectionUrl}); const connectionPromise = client.connect(); const done = () => {}; connectionPromise.then(() => { callback(undefined, client, done); } }).catch((error) => { console.log(error); winston.error('error connecting to postgres', {error}); callback(error); }); } Loading