예제 #1
0
        public Task UpdateHangFireCounter(HangFireCounter hangFireCounter)
        {
            using (var context = _contextFactory.CreateDbContext(_connectionString))
            {
                context.HangFireCounter.Update(hangFireCounter);
                context.SaveChanges();
            };

            return(Task.CompletedTask);
        }
        public async Task SavingDataOrClearingBuffer()
        {
            HangFireCounter hangFireCounter = await _hangFireCounterRepository.GetHangFireCounter();

            if (hangFireCounter.Counter < hangFireCounter.Limit)
            {
                //await _sQLRawDataDownload.FilterOutNewSQLServerRequests();
                Console.WriteLine($"MSSQL server is being accessed. Counter: {hangFireCounter.Counter}, Limit: {hangFireCounter.Limit}.");
                hangFireCounter.Counter++;

                await _hangFireCounterRepository.UpdateHangFireCounter(hangFireCounter);
            }
            else
            {
                //await _eventBufferRepository.ClearEventSessionBuffer();
                Console.WriteLine($"Clearing the event session buffer. Counter: {hangFireCounter.Counter}, Limit: {hangFireCounter.Limit}.");
                hangFireCounter.Counter = 0;

                await _hangFireCounterRepository.UpdateHangFireCounter(hangFireCounter);
            }
        }