Пример #1
0
 public PostgreSqlSagaStorage(IOptions <PoleSagasStoragePostgreSqlOption> poleSagasStoragePostgreSqlOption, ISagaStorageInitializer sagaStorageInitializer)
 {
     this.poleSagasStoragePostgreSqlOption = poleSagasStoragePostgreSqlOption.Value;
     this.sagaStorageInitializer           = sagaStorageInitializer;
     sagaTableName     = sagaStorageInitializer.GetSagaTableName();
     activityTableName = sagaStorageInitializer.GetActivityTableName();
 }
Пример #2
0
        private async Task ProcessInternal()
        {
            var tables = new[] { sagaStorageInitializer.GetSagaTableName() };

            foreach (var table in tables)
            {
                logger.LogDebug($"Collecting expired data from table: {table}");

                int deletedCount;
                var time = DateTime.UtcNow;
                do
                {
                    deletedCount = await sagaStorage.DeleteExpiredData(table, time, options.ExpiredDataDeleteBatchCount);

                    if (deletedCount == options.ExpiredDataDeleteBatchCount)
                    {
                        await Task.Delay(options.ExpiredDataPreBulkDeleteDelaySeconds * 1000);
                    }
                } while (deletedCount == options.ExpiredDataDeleteBatchCount);
            }
        }