How to use the pg.end function in pg

To help you get started, we’ve selected a few pg examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mozilla / chronicle / server / db / migrator.js View on Github external
pgpatcher(client, level, {dir: path.join(__dirname, 'migrations')}, function onPatched(err, result) {
        log.debug('pgpatcher callback fired');
        if (err) {
          log.error('pgpatcher migration failed: ' + err);
          done();
          pg.end();
          return deferred.reject(err);
        }
        log.info('pgpatcher migration succeeded');
        // at patchLevel 0 and 1, there is no user_pages table to reindex
        if (patchLevel < 2) {
          done();
          pg.end();
          return deferred.resolve(result);
        }
        reindex.start(function(err) {
          if (err) {
            log.error('elasticsearch reindexing failed: ' + err);
            done();
            pg.end();
            return deferred.reject(err);
          }
          log.info('elasticsearch reindexing succeeded');
          done();
          pg.end();
          deferred.resolve(result);
        });
      });
    }
github mozilla / chronicle / server / index.js View on Github external
process.on('exit', function onExit() {
  log.verbose('received exit signal, closing pool');
  pg.end();
});
github usecanvas / livedb-postgresql / index.js View on Github external
LivePg.close = function close(cb) {
  if (this.willClose) {
    cb();
  } else {
    pg.once('end', cb);
    pg.end();
  }
};