Apparent lag when saving ParseRelation and then retrieving it

27 Views Asked by At

So I have a Trip class and Place class that both extend ParseObject and have a many to many relationship between them. So I am using a ParseRelation like so:

Trip trip = ...
Place place = ...
trip.getRelation('place_relation').add(place);
trip.saveEventually();

Then, later on I fetch the places like so:

final ArrayList<Place> places;
        ParseRelation<Place> placeParseRelation = trip.getRelation("place_relation");
        ParseQuery<Place> placeParseQuery = placeParseRelation.getQuery();

        placeParseQuery.findInBackground(new FindCallback<Place>() {
            @Override
            public void done(List<Place> objects, ParseException e) {
                if (e != null) {
                    ...
                } else {
                    places = (ArrayList<Place>) objects;
                }
            }
        });

I realize that because I'm using saveEventually() there might be a lag between when it is written to the db and fetching from the DB, but realistically it should be <1 sec for this to save properly. However I've found that it can take up to 5 minutes before the Places are returned in the query. It's quite variable how long it takes before the results show up, sometimes it is almost instant and, like I mentioned, sometimes it can be several minutes. I am on a fast internet connection using a new GenyMotion emulator.

Any ideas why this might be happening?

0

There are 0 best solutions below