-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Nh/refresh send realmchanged #2319
Conversation
…ealm-java into cm/handler-notifications
@realm/java |
@Test | ||
public void processLocalListenersAfterRefresh() throws InterruptedException { | ||
public void processRefreshLocalListenersAfterLooperQueueStart() throws Throwable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't this be simplified immensely using @RunTestInLooperThread
?
@Test
@RunTestInLooperThread
public void test() {
// Setup listeners and stuff.
realm.refresh()
// Verify that listeners haven't been called yet
}
After calling If it just send the |
I agree the name |
But I think that raises the question of why even having it then? Because a refresh will only trigger change listeners if something actually changed, and if something changed a |
It make sense to remove it then, if we have another mechanism for non-Looper thread |
Yes, I think it would be the natural consequence if we don't want to have a |
@stk1m1
We should probably be careful with exactly how a thread is blocked using this method, we should as a minimum abort if the thread is interrupted. |
This PR is replaced by #2386 |
This PR is the continuation of the wok done in #2233 (delay notification)
This will make
refresh
send aREALM_CHANGE
instead of advancing the Realm. This adds more consistency and make it more easy to reason about async queries/update, as now all the changes are processed via the Looper.Note: the behaviour of
refresh
is unchanged for non-Looper thread