Skip to content

Commit db031ff

Browse files
committed
Move properties model's change propagation outside of the lock
* Keep the lock minimal, just around write and read access to the tags dictionary * Move the events-driving outside of the lock, that create Deltas and caches the model, etc.
1 parent ac60efc commit db031ff

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSPropertiesModel.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,19 +139,19 @@ class OSPropertiesModel: OSModel {
139139
for (key, value) in tags {
140140
self.tags[key] = value
141141
}
142-
self.set(property: "tags", newValue: tags)
143142
}
143+
self.set(property: "tags", newValue: tags)
144144
}
145145

146146
func removeTags(_ tags: [String]) {
147+
var tagsToSend: [String: String] = [:]
147148
tagsLock.withLock {
148-
var tagsToSend: [String: String] = [:]
149149
for tag in tags {
150150
self.tags.removeValue(forKey: tag)
151151
tagsToSend[tag] = ""
152152
}
153-
self.set(property: "tags", newValue: tagsToSend)
154153
}
154+
self.set(property: "tags", newValue: tagsToSend)
155155
}
156156

157157
public override func hydrateModel(_ response: [String: Any]) {

0 commit comments

Comments
 (0)