Avoid nested steps
This commit is contained in:
parent
2f011c3266
commit
7c1e2a6af0
@ -513,24 +513,27 @@ LayergroupController.prototype.getAffectedTables = function(user, dbName, layerg
|
||||
|
||||
return queries.length ? queries.join(';') : null;
|
||||
},
|
||||
function findAffectedTables(err, sql) {
|
||||
function getConnection(err, sql) {
|
||||
assert.ifError(err);
|
||||
|
||||
if ( ! sql ) {
|
||||
throw new Error("this request doesn't need an X-Cache-Channel generated");
|
||||
}
|
||||
|
||||
step(
|
||||
function getConnection() {
|
||||
self.pgConnection.getConnection(user, this);
|
||||
},
|
||||
function getAffectedTables(err, connection) {
|
||||
assert.ifError(err);
|
||||
const next = this;
|
||||
|
||||
QueryTables.getAffectedTablesFromQuery(connection, sql, this);
|
||||
},
|
||||
this
|
||||
);
|
||||
self.pgConnection.getConnection(user, function (err, connection) {
|
||||
if (err) {
|
||||
return next();
|
||||
}
|
||||
|
||||
next(null, connection, sql);
|
||||
});
|
||||
},
|
||||
function getAffectedTables(err, connection, sql) {
|
||||
assert.ifError(err);
|
||||
|
||||
QueryTables.getAffectedTablesFromQuery(connection, sql, this);
|
||||
},
|
||||
function buildCacheChannel(err, tables) {
|
||||
assert.ifError(err);
|
||||
|
Loading…
Reference in New Issue
Block a user