1 of 1 people found this helpful
You can disable background sync by setting poll interval to 0 in rhoconfig.txt:
You can also change it dynamically:
Update the SyncEngine poll interval. Setting this to 0 will disable polling-based sync. However, you may still use <http://docs.rhomobile.com/rhoconnect/push> push-based-sync.
#=> now polls every 20 seconds
>>Does "enable :sync" have to be enabled on the Model to use those calls?
>>If so, how do you prevent sync from running for a particular model when SyncEngine.do_sync is called?
You can disable/enable sync of the models using:
db = ::Rho::RHO.get_src_db(source_name)
I have already set the sync_poll_interval to 0. That way, the application only syncs when the user first logs in or initializes the application.
Querying the database and flipping sync on and off seems like a lot of unnecessary work so I will try to see what else I can come up with.
I was hoping that I was missing a built in feature that would allow me to exclude syncing specific Models until I wanted to manually sync them. I tried setting the poll interval associated with the Model to 0 in the Settings.yml file in my RhoConnect application (thinking that it would be the same as setting the sync_poll_interval to 0 for the application, but at the Model level), but that did not affect anything. I also tried commenting out the polling in the same file.
Message was edited by: Matt Travis As clarification to the above, I realize that trying to change poll intervals would not logically affect SyncEngine.do_sync being run on the initial load. I was just hoping that it would. I guess I am looking for a property that removes the Model from the SyncEngine.do_sync Model list so I can individually call Model.do_sync. Something like "enable :selfsync" (does not exist as far as I am aware) where if "enable :sync" does not exist and the "enable :selfsync" value exists, the sync option is still loaded for the Model, but it is not included in the SyncEngine.do_sync overall sync process.
I think what I am going to do is just create a function that manually syncs a specific set of Models (top level) on the application load and then I can manually trigger the others later. That way, SyncEngine.do_sync isn't calling all of the Models.