kastiglione / Parse-RACExtensions

ReactiveCocoa for Parse
MIT License
61 stars 9 forks source link

rac_deleteAll hangs indefinitely #19

Closed fatuhoku closed 10 years ago

fatuhoku commented 10 years ago

I wanted to write unit tests against Parse and I came up with the following to purge a bunch of objects:

            [[PFObject rac_deleteAll:objects] waitUntilCompleted:nil];

This call hung forever with a total of two objects passed in. Why?

kastiglione commented 10 years ago

The code looks legit. I've never used -waitUntilCompleted:. I'll have to check it out before I can comment.

kastiglione commented 10 years ago

a total of two objects passed in

What do you mean by this?

fatuhoku commented 10 years ago

Oh, all I meant was:

           NSArray *objects = @[o1, o2];  // o1 and o2 are both PFObjects
           [[PFObject rac_deleteAll:objects] waitUntilCompleted:nil];

I wanted to clarify that because conceivably passing in 135913904732 objects might conceivably cause the hang ;)

kastiglione commented 10 years ago

Can you set a breakpoint inside the block defined within PFRACBooleanCallback, and see if it's being called?

My first thoughts are:

  1. Either the Parse callback that backs -rac_deleteAll: isn't being called
  2. There's some bug in -waitUntilCompleted:

On the subject of number 2, why are you using -waitUntilCompleted:? It's intended to be more for testing. Why won't simply using -subscribeCompleted: work for you?

fatuhoku commented 10 years ago

I put a breakpoint inside the block inside PFRACBooleanCallback as you said — I don't see it ever being reached.

Hit the nail on the head! I'm using -waitUntilCompleted: because I'm writing synchronous tests against a Parse backend. I cannot tell which of these is causing the hang.

fatuhoku commented 10 years ago

@kastiglione I found that if I use asynchronously

        [[PFObject rac_deleteAll:objects] asynchronouslyWaitUntilCompleted:nil];

...it works. This could well be because XCTest manages test execution on the main thread but starts new threads for each test.

fatuhoku commented 10 years ago

I made an issue over at ReactiveCocoa/ReactiveCocoa#1495 to document this. Cheers!

kastiglione commented 10 years ago

:beers: