periodicallyRequestMissingCache method

Future<void> periodicallyRequestMissingCache()

Implementation

Future<void> periodicallyRequestMissingCache() async {
  if (_isPeriodicallyRequestingMissingCache ||
      (_lastCacheRequest != null &&
          DateTime.now()
              .subtract(Duration(minutes: 15))
              .isBefore(_lastCacheRequest!)) ||
      client.isUnknownSession) {
    // we are already requesting right now or we attempted to within the last 15 min
    return;
  }
  _lastCacheRequest = DateTime.now();
  _isPeriodicallyRequestingMissingCache = true;
  try {
    await maybeRequestAll();
  } finally {
    _isPeriodicallyRequestingMissingCache = false;
  }
}