On-shot pull sync

If I create a one-shot (non-continuous) pull replication task from the REST API will it return immediately? Or will it wait until all the data has been replicated before returning?

Do you mean calling the Sync Gateway _replicate endpoint?

http://developer.couchbase.com/documentation/mobile/current/develop/references/sync-gateway/rest-api/index.html#operation--_replicate-post

Assuming that’s what you are asking, it runs synchronously by default:

and the request will block until the replication has finished.

But there is an undocumented parameter “async” (boolean) that you can add to the JSON which will make it run asynchronously:

Thanks, I wan’t it to run synchronously. I just saw an awful lot of logging in xCode after the task had returned and wondered if it was because it was still running.

One-shot replications are a synchronous HTTP call, continuous ones are asynchronous (obviously, since otherwise it would never return…)