Skip to content

Commit efdb3e2

Browse files
committed
docs
1 parent 9ffe306 commit efdb3e2

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

src/Abstract/IBackgroundQueue.cs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,40 @@
55
namespace Soenneker.Utils.BackgroundQueue.Abstract;
66

77
/// <summary>
8-
/// Adds Tasks and ValueTasks to the <see cref="QueuedHostedService"/>. <para/>
9-
/// Must be Singleton IoC
8+
/// Interface for queuing tasks and value tasks to be processed by the <see cref="QueuedHostedService"/>.
109
/// </summary>
10+
/// <remarks>
11+
/// This service must be registered as a singleton in the IoC container.
12+
/// </remarks>
1113
public interface IBackgroundQueue
1214
{
15+
/// <summary>
16+
/// Queues a <see cref="ValueTask"/> to be executed by the background service.
17+
/// </summary>
18+
/// <param name="workItem">A function representing the work item, which accepts a <see cref="CancellationToken"/> and returns a <see cref="ValueTask"/>.</param>
19+
/// <param name="cancellationToken">An optional token to cancel the operation.</param>
20+
/// <returns>A <see cref="ValueTask"/> representing the asynchronous operation.</returns>
1321
ValueTask QueueValueTask(Func<CancellationToken, ValueTask> workItem, CancellationToken cancellationToken = default);
1422

23+
/// <summary>
24+
/// Queues a <see cref="Task"/> to be executed by the background service.
25+
/// </summary>
26+
/// <param name="workItem">A function representing the work item, which accepts a <see cref="CancellationToken"/> and returns a <see cref="Task"/>.</param>
27+
/// <param name="cancellationToken">An optional token to cancel the operation.</param>
28+
/// <returns>A <see cref="ValueTask"/> representing the asynchronous operation.</returns>
1529
ValueTask QueueTask(Func<CancellationToken, Task> workItem, CancellationToken cancellationToken = default);
1630

31+
/// <summary>
32+
/// Dequeues a <see cref="ValueTask"/> from the queue for execution.
33+
/// </summary>
34+
/// <param name="cancellationToken">An optional token to cancel the operation.</param>
35+
/// <returns>A <see cref="ValueTask"/> containing a function that represents the dequeued work item, which accepts a <see cref="CancellationToken"/> and returns a <see cref="ValueTask"/>.</returns>
1736
ValueTask<Func<CancellationToken, ValueTask>> DequeueValueTask(CancellationToken cancellationToken = default);
1837

38+
/// <summary>
39+
/// Dequeues a <see cref="Task"/> from the queue for execution.
40+
/// </summary>
41+
/// <param name="cancellationToken">An optional token to cancel the operation.</param>
42+
/// <returns>A <see cref="ValueTask"/> containing a function that represents the dequeued work item, which accepts a <see cref="CancellationToken"/> and returns a <see cref="Task"/>.</returns>
1943
ValueTask<Func<CancellationToken, Task>> DequeueTask(CancellationToken cancellationToken = default);
2044
}

src/BackgroundQueue.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public async ValueTask QueueValueTask(Func<CancellationToken, ValueTask> workIte
6060
{
6161
// TODO: need to redo this, we're going to get too many warnings
6262

63-
int count = await _informationUtil.IncrementValueTaskCounter(cancellationToken).ConfigureAwait(false);
63+
int count = await _informationUtil.IncrementValueTaskCounter(cancellationToken).NoSync();
6464

6565
if (count > _queueWarning)
6666
{

0 commit comments

Comments
 (0)