Bump sender certificate timer after registration for re-link
This commit is contained in:
parent
7d54f7928d
commit
55c3d9371e
1 changed files with 8 additions and 4 deletions
|
@ -7,9 +7,9 @@ module.exports = {
|
||||||
const ONE_DAY = 24 * 60 * 60 * 1000; // one day
|
const ONE_DAY = 24 * 60 * 60 * 1000; // one day
|
||||||
const MINIMUM_TIME_LEFT = 2 * 60 * 60 * 1000; // two hours
|
const MINIMUM_TIME_LEFT = 2 * 60 * 60 * 1000; // two hours
|
||||||
|
|
||||||
let initialized = false;
|
|
||||||
let timeout = null;
|
let timeout = null;
|
||||||
let scheduledTime = null;
|
let scheduledTime = null;
|
||||||
|
let scheduleNext = null;
|
||||||
|
|
||||||
// We need to refresh our own profile regularly to account for newly-added devices which
|
// We need to refresh our own profile regularly to account for newly-added devices which
|
||||||
// do not support unidentified delivery.
|
// do not support unidentified delivery.
|
||||||
|
@ -20,11 +20,12 @@ function refreshOurProfile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function initialize({ events, storage, navigator, logger }) {
|
function initialize({ events, storage, navigator, logger }) {
|
||||||
if (initialized) {
|
// We don't want to set up all of the below functions, but we do want to ensure that our
|
||||||
logger.warn('refreshSenderCertificate: already initialized!');
|
// refresh timer is up-to-date.
|
||||||
|
if (scheduleNext) {
|
||||||
|
scheduleNext();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
initialized = true;
|
|
||||||
|
|
||||||
runWhenOnline();
|
runWhenOnline();
|
||||||
|
|
||||||
|
@ -55,6 +56,9 @@ function initialize({ events, storage, navigator, logger }) {
|
||||||
setTimeoutForNextRun(time);
|
setTimeoutForNextRun(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Keeping this entrypoint around so more inialize() calls just kick the timing
|
||||||
|
scheduleNext = scheduleNextRotation;
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
logger.info('refreshSenderCertificate: Getting new certificate...');
|
logger.info('refreshSenderCertificate: Getting new certificate...');
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue