Skip to content

Commit e87f040

Browse files
committed
Revert "Moved TrySetResult to loop so that both TrySetResult and TrySetException are managed in the same code"
This reverts commit 251f167.
1 parent 76f26ec commit e87f040

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/ServiceControl.Audit/Auditing/AuditIngestion.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -235,16 +235,6 @@ async Task Loop(CancellationToken cancellationToken)
235235
auditBatchSize.Record(contexts.Count);
236236

237237
await auditIngestor.Ingest(contexts, cancellationToken);
238-
239-
foreach (var context in contexts)
240-
{
241-
// Some items that faulted could already have been set
242-
if (!context.GetTaskCompletionSource().TrySetResult(true))
243-
{
244-
logger.Warn("TrySetResult failed");
245-
}
246-
}
247-
248238
auditBatchDuration.Record(sw.ElapsedMilliseconds);
249239

250240
// No locking for consistency needed, just write, don't care about multi-threading

src/ServiceControl.Audit/Auditing/AuditIngestor.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ public async Task Ingest(List<MessageContext> contexts, CancellationToken cancel
6666
Log.Debug("Forwarded messages");
6767
}
6868
}
69+
70+
foreach (var context in contexts)
71+
{
72+
if (!context.GetTaskCompletionSource().TrySetResult(true))
73+
{
74+
Log.Warn("TrySetResult failed");
75+
}
76+
}
6977
}
7078
catch (Exception e)
7179
{

0 commit comments

Comments
 (0)