New SQL indices and query tweaks to eliminate table scans

Also: New logging on client side to track performance of db queries
This commit is contained in:
Scott Nonnenberg 2018-08-08 18:32:10 -07:00
parent 85ab4e567f
commit c88df69094
2 changed files with 61 additions and 11 deletions

View file

@ -112,6 +112,7 @@ function _makeJob(fnName) {
_jobs[id] = {
fnName,
start: Date.now(),
};
return id;
@ -119,16 +120,25 @@ function _makeJob(fnName) {
function _updateJob(id, data) {
const { resolve, reject } = data;
const { fnName, start } = _jobs[id];
_jobs[id] = {
..._jobs[id],
...data,
resolve: value => {
_removeJob(id);
const end = Date.now();
window.log.info(
`SQL channel job ${id} (${fnName}) succeeded in ${end - start}ms`
);
return resolve(value);
},
reject: error => {
_removeJob(id);
const end = Date.now();
window.log.info(
`SQL channel job ${id} (${fnName}) failed in ${end - start}ms`
);
return reject(error);
},
};