Conversation: Wait for database fetch to add incoming messages
This commit is contained in:
parent
0f9bc57ccb
commit
3e5071e340
4 changed files with 21 additions and 4 deletions
|
@ -47,8 +47,15 @@ function initialize({ events, storage, navigator, logger }) {
|
|||
);
|
||||
const expires = decoded.expires.toNumber();
|
||||
|
||||
const time = Math.min(now + ONE_DAY, expires - MINIMUM_TIME_LEFT);
|
||||
// If we have a time in place and it's already before the safety zone before expire,
|
||||
// we keep it
|
||||
if (scheduledTime && scheduledTime <= expires - MINIMUM_TIME_LEFT) {
|
||||
setTimeoutForNextRun(scheduledTime);
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise, we reset every day, or earlier if the safety zone requires it
|
||||
const time = Math.min(now + ONE_DAY, expires - MINIMUM_TIME_LEFT);
|
||||
setTimeoutForNextRun(time);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue