Import log instead of using it off of window
This commit is contained in:
parent
8eb0dd3116
commit
65ddf0a9e8
155 changed files with 3654 additions and 3433 deletions
|
@ -5,6 +5,7 @@ import { debounce, isNumber } from 'lodash';
|
|||
|
||||
import { strictAssert } from './assert';
|
||||
import Data from '../sql/Client';
|
||||
import * as log from '../logging/log';
|
||||
|
||||
let receivedAtCounter: number | undefined;
|
||||
|
||||
|
@ -18,26 +19,22 @@ export async function initializeMessageCounter(): Promise<void> {
|
|||
const dbCounter = await Data.getMaxMessageCounter();
|
||||
|
||||
if (isNumber(dbCounter) && isNumber(storedCounter)) {
|
||||
window.log.info(
|
||||
'initializeMessageCounter: picking max of db/stored counters'
|
||||
);
|
||||
log.info('initializeMessageCounter: picking max of db/stored counters');
|
||||
receivedAtCounter = Math.max(dbCounter, storedCounter);
|
||||
|
||||
if (receivedAtCounter !== storedCounter) {
|
||||
window.log.warn(
|
||||
'initializeMessageCounter: mismatch between db/stored counters'
|
||||
);
|
||||
log.warn('initializeMessageCounter: mismatch between db/stored counters');
|
||||
}
|
||||
} else if (isNumber(storedCounter)) {
|
||||
window.log.info('initializeMessageCounter: picking stored counter');
|
||||
log.info('initializeMessageCounter: picking stored counter');
|
||||
receivedAtCounter = storedCounter;
|
||||
} else if (isNumber(dbCounter)) {
|
||||
window.log.info(
|
||||
log.info(
|
||||
'initializeMessageCounter: picking fallback counter from the database'
|
||||
);
|
||||
receivedAtCounter = dbCounter;
|
||||
} else {
|
||||
window.log.info('initializeMessageCounter: defaulting to Date.now()');
|
||||
log.info('initializeMessageCounter: defaulting to Date.now()');
|
||||
receivedAtCounter = Date.now();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue