Skip to content

Commit

Permalink
Fixed function definition after call
Browse files Browse the repository at this point in the history
  • Loading branch information
numtel committed May 12, 2015
1 parent 04d4a38 commit d8ff2da
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,19 +240,6 @@ function(query, params, triggers, queryHash, handle) {
initialized : false
}

// Determine dependent tables, from cache if possible
if(queryHash in self.tablesUsedCache) {
attachTriggers(self.tablesUsedCache[queryHash]);
} else {
findDependentRelations(self.connStr, query, params,
function(error, result) {
if(error) return handle.emit('error', error);
self.tablesUsedCache[queryHash] = result;
attachTriggers(result);
}
);
}

var attachTriggers = function(tablesUsed) {
var queries = [];

Expand Down Expand Up @@ -283,6 +270,19 @@ function(query, params, triggers, queryHash, handle) {
// Retrieve initial results
self.waitingToUpdate.push(queryHash)
};

// Determine dependent tables, from cache if possible
if(queryHash in self.tablesUsedCache) {
attachTriggers(self.tablesUsedCache[queryHash]);
} else {
findDependentRelations(self.connStr, query, params,
function(error, result) {
if(error) return handle.emit('error', error);
self.tablesUsedCache[queryHash] = result;
attachTriggers(result);
}
);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pg-live-select",
"version": "1.0.0",
"version": "1.0.2",
"description": "Live updating PostgreSQL SELECT statements",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit d8ff2da

Please sign in to comment.