Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removeOverrides() evicts the entire cache #17

Closed
albertodebortoli opened this issue Jul 24, 2023 · 0 comments
Closed

removeOverrides() evicts the entire cache #17

albertodebortoli opened this issue Jul 24, 2023 · 0 comments
Assignees

Comments

@albertodebortoli
Copy link
Member

As @dchakarov pointed out, removeOverrides evicts the entire cache but it could just remove the values that have been overridden.

I think this should be a simple fix.

From:

public func removeOverrides() -> Set<Variable> {
    queue.sync(flags: .barrier) {
        defer { cache.evict() }
        ...

to:

public func removeOverrides() -> Set<Variable> {
    queue.sync(flags: .barrier) {
        guard let mutableValueProvider = mutableValueProvider else { return  [] }
        let variables = mutableValueProvider.variables
        for variable in variables {
            cache.removeValue(forKey: variable)
            DispatchQueue.main.async {
                self.subjectsRefs[variable]?.send(completion: .finished)
                self.subjectsRefs[variable] = nil
            }
        }
        ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants