Parse-SDK-Android icon indicating copy to clipboard operation
Parse-SDK-Android copied to clipboard

I can't cancel a query- Cancel method doesn't work.

Open uzaysan opened this issue 6 years ago • 0 comments

Hi. I wanna cancel ongoing parse query requests when activity destroyed. But seems like cancel method doesn't work.

I suspected cancel method doesn't work because I detected memory leaks via leak canary and leak related to parse queries that's still working even after I called cancel method. I made a test.

I start query and cancel right after it starts like this:

getUser.getFirstInBackground(new GetCallback<ParseUser>() {
        @Override
        public void done(ParseUser object, ParseException e) {
            //Cancel method runs before this method
            //Error is null and object retrieved successfully
        }
    });
    getUser.cancel();

Since getFirstInBackground method is async task, cancel method runs before done method. I check both exception object and result object. seems like query didnt stop and countinue working like nothing happend. Error object was null and result object retrieved succesfully.

How to solve this? How to cancel query?

uzaysan avatar Aug 30 '19 11:08 uzaysan