Thanks Jeff for the prompt response, coincidentally a few hours after writing this post, I managed to solve my problem by doing pretty much what you said. Making an explict call to "connect" after the datastore and dataservices are initialized correctly updated the commitRequired flag. I had thought that setting autoConnect to true would do the resync but I guess an explicit connect is required.
Thanks again. Dennis --- In flexcoders@yahoogroups.com, Jeffrey Vroom <j...@...> wrote: > > It sounds to me like you are just not getting that particular DataService > connected before you do the fill. There is a DataService.connect method if > I recall correctly that might help. I don't think you get > commitRequired=true when the app is in a disconnected state. The fill will > auto-connect before it runs so that would explain why it is initializing the > data store. > > The reconnect policy setting is set by default from the server > configuration. I think there is an api on the client which also sets it > though, probably on the DataStore property of the DataService.. note that > there is also a "refresh" operation on the DataService client which > essentially does the same thing only manually. > > It sounds to me like when you are calling fill, it reconnects which then > refreshes that fill as per the reconnect policy, then you do the fill again > so it happens twice. If you just call "connect", you can avoid that extra > fill call altogether. > > Jeff > > On Tue, Feb 9, 2010 at 10:07 AM, Dennis <dennis....@...> wrote: > > > > > > > I want to determine if the following offline synchronization behaviour is > > by design or a result of some improper LCDS config or client code. > > > > Scenario: > > After committing a change to the offline cache, I see the "commitRequire" > > flag on the DataStore is set as true and I save the offline cache. Next, I > > close the app, start up my server and restart the app expect the offline > > data to by synchronized. > > > > On application restart one thing I noticed is that on initialization of the > > DataService and DataStore, the "commitRequire" is false even though the > > offline DataStore was previously required a commit. If I do a fill for data > > that was modified in offline mode, my success callback registered to the > > AsyncToken from the fill call is called twice. It seems one result of the > > fill is coming from the offline data cache and the other is from the server > > side data. After the fill call, the "commitRequire" flag of the DataStore is > > now set to be true and that is were I do a commit. > > > > Q. > > Is this expected? Does LCDS compare the fill results between the offline > > cache and the server data to determine if "commitRequire" is true? Should I > > blindly call commit once I leave offline mode and delete the offline cache? > > If I delete the offline cache from the filesystem, the callback from the > > fill is only called once. Ideally I want the callback from the fill to only > > be called once and to contain the synchronized results of the fill. > > > > Q. > > In looking at the LCDS dev guide is see the follow passage in Chapter 18: > > Advanced data handling: > > "If there is a connection available after the local cache is loaded, the > > current reconnectPolicy property value is > > consulted to determine how a request for the current data will be made. If > > the reconnectPolicy property is set to > > IDENTITY, no request for remote data is made because it is assumed that the > > data is up-to-date. If the > > reconnectPolicy property is set to INSTANCE, a request for the remote data > > is made and the result of that fill is used > > to overwrite the current in-memory version." > > > > Where is the "reconnectPolicy" defined and do I need to change this? > > > > I apologize for the length of the post, I've tried to be as concise as > > possible. > > > > > > >