startAutoRetrieval method

void startAutoRetrieval()

Start automatic message retrieval

Implementation

void startAutoRetrieval() {
  if (_autoRetrievalTimer != null) {
    _logger.warning('Auto-retrieval already started');
    return;
  }

  _logger.info('Starting auto-retrieval (interval: ${config.retrievalInterval.inSeconds}s)');

  _autoRetrievalTimer = Timer.periodic(config.retrievalInterval, (_) async {
    try {
      await retrieveMessages();
    } catch (e) {
      _logger.warning('Error during auto-retrieval: $e');
    }
  });
}