Exemplo n.º 1
0
        public override async Task <GetAllResponse> GetAll(GetAllRequest request, ServerCallContext context)
        {
            var sessions = await _localSessionRepo.GetAll();

            return(new GetAllResponse
            {
                Sessions = { sessions }
            });
        }
Exemplo n.º 2
0
        public async Task Sync()
        {
            var settings = _settingsService.Get();

            if (!settings.Remote.IsOnline)
            {
                throw new Exception("Can't sync servers when we are offline");
            }

            _logger.LogInformation("Starting sync of sessions");
            var localSessions  = (await _localSessionRepo.GetAll()).ToDictionary(session => session.Id);
            var remoteSessions = (await _remoteSessionRepo.GetAll()).ToDictionary(session => session.Id);

            _logger.LogDebug($"Have {localSessions.Count} sessions locally");
            _logger.LogDebug($"Have {remoteSessions.Count} sessions on server");

            await SyncDbs(localSessions, remoteSessions);
        }