Skip to content

Threading #60

@ashitikov

Description

@ashitikov

Hello, @plivesey, thank you for the library!
Why does any work with addModelUpdatesListener and removeModelUpdatesListener should be done on main thread?
https://github.com/plivesey/ConsistencyManager-iOS/blob/master/ConsistencyManager/ConsistencyManager.swift#L416

I ask because I have an intention to write through the RocketData's provider setData(...) using background thread, and there is some logic around llisteningToModelIdentifier property. And so I have some crashes because array modelUpdatesListeners out of sync https://github.com/plivesey/ConsistencyManager-iOS/blob/master/ConsistencyManager/ConsistencyManager.swift#L102 .
On the other hand there is similar listeners array, and ConsistencyManager synchronize access through internal queue using dispatchTask(...).

Is there some valuable reason to access model updates listeners on main thread only?
If not I propose to use dispatchTask in similar way as work with listeners array. I can do a PR.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions