Skip to content

Conversation

@bok-
Copy link
Contributor

@bok- bok- commented Dec 17, 2024

📒 Description

Vexil 2 allowed direct manipulation of its source's via the setter on the _sources property. This was no thread safe since it involved a read, manipulation of a local copy, and then setting it. It also meant multiple step operations like finding + removing an existing FlagValueSource and replacing it would call the didSet observer multiple times if not careful, resulting in unnecessary snapshots and publishing.

This PR removes the direct setter in favour of an updateSources method that takes a closure and is passed a mutable copy of the sources array, which can be safely manipulated within the closer before being saved back again, and only one observer triggered.

@bok- bok- added the vexil3 Part of the Vexil 3 alpha/beta development label Dec 17, 2024
@bok- bok- enabled auto-merge December 17, 2024 11:44
@sonarqubecloud
Copy link

@bok- bok- merged commit 58f6b23 into main Dec 17, 2024
39 checks passed
@bok- bok- deleted the remove-direct-source-setter branch December 17, 2024 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

vexil3 Part of the Vexil 3 alpha/beta development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants