Skip to content

Commit 59902df

Browse files
docs(audience): drop stale _consent refs and tighten _state lock comment
Two comments still named the pre-refactor _consent field; one class-level comment enumerated only Identify / Reset as taking _initLock, which is now true of every _state write. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 5882f8b commit 59902df

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/Packages/Audience/Runtime/ImmutableAudience.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ public static class ImmutableAudience
1515
// Reference fields are written inside _initLock; readers check the
1616
// `volatile _initialized` flag first so they never see a half-initialised state.
1717
// _state (consent level + userId) and _session are volatile so a write
18-
// on one thread is visible on any other. Writes happen under _initLock
19-
// (Identify / Reset / SetConsent also take it) so level and userId
20-
// always move together — callers never observe (Anonymous, oldUserId).
18+
// on one thread is visible on any other. Every _state write happens
19+
// under _initLock so level and userId always move together — callers
20+
// never observe (Anonymous, oldUserId).
2121
//
2222
// Init / Shutdown / Reset / SetConsent hold _initLock only to flip state
2323
// and capture references; they release the lock before running blocking
@@ -789,7 +789,7 @@ private static void RescheduleSendTimer(HttpTransport transport)
789789
timer.Change(nextMs, sendIntervalMs);
790790
}
791791

792-
// consentAtInit only gates the launch; Track still checks live _consent via CanTrack.
792+
// consentAtInit only gates the launch; Track still checks live _state via CanTrack.
793793
private static void FireGameLaunch(AudienceConfig config, ConsentLevel consentAtInit)
794794
{
795795
if (!consentAtInit.CanTrack()) return;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ public void SetConsent_DowngradeToNone_StressTest_NoLeak()
568568
// before SetConsent starts on a fast machine. This stress variant runs
569569
// the race many times with many concurrent Track threads so at least
570570
// some iterations are guaranteed to land the enqueue inside the
571-
// _consent=None/PurgeAll window.
571+
// _state=None/PurgeAll window.
572572
//
573573
// Without the EnqueueChecked re-check, this test leaks events
574574
// reproducibly. With the fix, zero leaks across all iterations.

0 commit comments

Comments
 (0)