Commit 0f10dfcb authored by mercury233's avatar mercury233

fix

parent 3fe8a7f6
...@@ -103,7 +103,13 @@ users_cache = {} ...@@ -103,7 +103,13 @@ users_cache = {}
if settings.modules.mycard.enabled if settings.modules.mycard.enabled
pgClient = require('pg').Client pgClient = require('pg').Client
pg_client = new pgClient(settings.modules.mycard.auth_database) pg_client = new pgClient(settings.modules.mycard.auth_database)
pg_client.on 'error', (err) ->
log.warn "PostgreSQL ERROR: ", err
return
pg_query = pg_client.query('SELECT username, id from users') pg_query = pg_client.query('SELECT username, id from users')
pg_query.on 'error', (err) ->
log.warn "PostgreSQL Query ERROR: ", err
return
pg_query.on 'row', (row) -> pg_query.on 'row', (row) ->
#log.info "load user", row.username, row.id #log.info "load user", row.username, row.id
users_cache[row.username] = row.id users_cache[row.username] = row.id
......
...@@ -144,7 +144,13 @@ ...@@ -144,7 +144,13 @@
if (settings.modules.mycard.enabled) { if (settings.modules.mycard.enabled) {
pgClient = require('pg').Client; pgClient = require('pg').Client;
pg_client = new pgClient(settings.modules.mycard.auth_database); pg_client = new pgClient(settings.modules.mycard.auth_database);
pg_client.on('error', function(err) {
log.warn("PostgreSQL ERROR: ", err);
});
pg_query = pg_client.query('SELECT username, id from users'); pg_query = pg_client.query('SELECT username, id from users');
pg_query.on('error', function(err) {
log.warn("PostgreSQL Query ERROR: ", err);
});
pg_query.on('row', function(row) { pg_query.on('row', function(row) {
users_cache[row.username] = row.id; users_cache[row.username] = row.id;
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment