Skip to content

Commit 14b57a1

Browse files
refactor(audience): rename FlushAsync to FlushSync in EventQueue
Addresses cursor[bot] review comment on EventQueue.cs:67. The method blocks synchronously and returns void — the Async suffix is misleading in C# where it conventionally signals a Task-returning, awaitable method. Renaming to FlushSync makes the blocking semantics explicit. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4abcade commit 14b57a1

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/Packages/Audience/Runtime/Transport/EventQueue.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ internal void Enqueue(string json)
6262
/// Drains the in-memory queue and persists all events to disk immediately.
6363
/// Blocks until the drain is complete.
6464
/// </summary>
65-
internal void FlushAsync()
65+
internal void FlushSync()
6666
{
6767
DrainMemoryToDisk();
6868
}

src/Packages/Audience/Tests/Runtime/EventQueueTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ public void TearDown()
2727
}
2828

2929
[Test]
30-
public void Enqueue_ThenFlushAsync_PersistesEventToDisk()
30+
public void Enqueue_ThenFlushSync_PersistesEventToDisk()
3131
{
3232
using var queue = new EventQueue(_store, flushIntervalSeconds: 60, flushSize: 100);
3333

3434
queue.Enqueue("{\"event\":\"track\"}");
35-
queue.FlushAsync();
35+
queue.FlushSync();
3636

37-
Assert.AreEqual(1, _store.Count(), "event should be on disk after FlushAsync");
37+
Assert.AreEqual(1, _store.Count(), "event should be on disk after FlushSync");
3838
}
3939

4040
[Test]
@@ -45,7 +45,7 @@ public void Enqueue_MultipleEvents_AllPersistedAfterFlush()
4545
for (var i = 0; i < 10; i++)
4646
queue.Enqueue($"{{\"i\":{i}}}");
4747

48-
queue.FlushAsync();
48+
queue.FlushSync();
4949

5050
Assert.AreEqual(10, _store.Count());
5151
}
@@ -65,7 +65,7 @@ public void FlushSize_Trigger_DrainsToDiskAutomatically()
6565
Thread.Sleep(20);
6666

6767
Assert.AreEqual(flushSize, _store.Count(),
68-
"reaching FlushSize should trigger automatic drain without explicit FlushAsync");
68+
"reaching FlushSize should trigger automatic drain without explicit FlushSync");
6969
}
7070

7171
[Test]

0 commit comments

Comments
 (0)