Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Allow replication to continue as background task #255

Open
EricGenet opened this Issue · 3 comments

4 participants

@EricGenet

Hi,

We have an app which needs a fair amount of data in couch before being able to start (8Mb with attachments across 7000 documents). Once the initial pull from the server is done, restarting the app is very quick, but at first we are looking at anything between 1min to 4 mins depending on the network conditions.

Our design approach to work around this is to let the user leave the app, run the initial replication in the background (using a long running background task the UIApplication background task API with beginBackgroundTaskWithExpirationHandler) and fire a local notification once everything is done.

But despite wrapping the backgroundTask around our replication code, every time the app enters in the background the CouchReplication reports a "completed" status and stops.

Is there a way of achieving this?

Thanks

@snej
Owner

There's not currently a way to do this, although it would definitely be a good idea. The replicator doesn't use the backgroundTask API, so for safety's sake it shuts down all replications when the app goes into the background.

The simplest fix would be to add a flag on a replication that tells it not to stop when the app is backgrounded. The app would be responsible for talking to UIApplication to start up a backgroundTask and stop the replication when required.

Better but more complex would be to have the replicator use the backgroundTask API itself. If the background flag were set, the replicator would take care of registering a backgroundTask and stopping itself when needed.

@stemail23

+1 for this feature!

@mikeplatt

+1 from me too!

@snej snej was assigned
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.