Files
fiscalos/src/FiscalOS.Infra/Queuing/ChannelAsyncQueue.cs
T
Stevan Freeborn a9f1ced0d5 feat: add Plaid transaction handling and async queue processing
- introduced new migration to add Cursor column to AccountMetadata.
- updated AppDbContext model snapshot to reflect changes in the database schema.
- implemented async queue processing with ChannelAsyncQueue and AsyncQueueHostedService.
- created Plaid transaction handlers for added, modified, and removed transactions.
- developed PlaidTransactionService and PlaidTransactionSyncer for syncing transactions.
- added SyncUpdatesProcessor to handle sync updates from Plaid.
- updated tests to accommodate changes in institution and account metadata handling.
2026-03-09 04:29:01 -05:00

32 lines
805 B
C#

namespace FiscalOS.Infra.Queuing;
internal class ChannelAsyncQueue<T> : IAsyncQueue<T>
{
private readonly Channel<T> _channel = Channel.CreateUnbounded<T>();
private ChannelAsyncQueue()
{
}
public static ChannelAsyncQueue<T> From(IServiceProvider serviceProvider)
{
return new();
}
public async Task EnqueueAsync(T item, CancellationToken cancellationToken = default)
{
await _channel.Writer.WriteAsync(item, cancellationToken).ConfigureAwait(false);
}
public async Task<T> DequeueAsync(CancellationToken cancellationToken = default)
{
return await _channel.Reader.ReadAsync(cancellationToken).ConfigureAwait(false);
}
public async ValueTask DisposeAsync()
{
_channel.Writer.Complete();
await _channel.Reader.Completion.ConfigureAwait(false);
}
}