Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions FlagsmithClient/Classes/Flagsmith.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,16 @@ public final class Flagsmith: @unchecked Sendable {
// The last time we got flags via the API
private var lastUpdatedAt: Double = 0.0

// The last identity used for fetching flags
private var lastUsedIdentity: String?
// The last identity used for fetching flags. Backed by a serialized
// accessor because `getFeatureFlags(forIdentity:...)` writes it
// unconditionally on entry, on whatever executor the caller is on —
// concurrent async callers race here and can corrupt the String? storage.
private var _lastUsedIdentity: String?
private var lastUsedIdentity: String? {
get { apiManager.propertiesSerialAccessQueue.sync { _lastUsedIdentity } }
set { apiManager.propertiesSerialAccessQueue.sync { _lastUsedIdentity = newValue } }
}

// The last result from fetching flags
internal var lastFlags: [Flag]?

Expand Down
Loading