After Failed Load Request DataManager Thinks VM is Cached

Apr 25, 2011 at 7:43 PM

I am having an issue when a ViewModel fails to load (say due to a network issue) and the next time I attempt to load it, it appears to return an imcomplete one from the cache. The ViewModel in question has a proxy registered for it so it has some data loaded but not fully expanded. Not sure if there is something I need to do to make sure if a ViewModel fails to load that subsequent calls will not result in a cached value being returned.

thanks for any guidance
Michael

Coordinator
Apr 26, 2011 at 5:03 PM

Hi Michael -

For the second load failing, I think there is some tuning I need to do here.  Right now, to avoid a barrage of requests to a failed call, there is a timeout for failed live loads, so subsequent calls won't kick off another live load unless Refresh<> is called or something.  It is currently (and arbitrarily, I'll admit) 60 seconds, you can see it at CacheEntry.LiveValueLoader.RetryTimeout.  So that's probably why it's falling back to the cached value.  We can fiddle with that a bit.

First I'd like to understand the incomplete cache load.  Can you describe that a bit more?  Can you verify that the cache has all the right data, or is there an exception or something like that?  I'd like to see why you're not getting a full value, that's not something I'd expect.

Does your code know about the failed load?  If you call Refresh, it should force a full reload.  Let me know if that works, etc.

Thanks,


Shawn

Apr 26, 2011 at 6:45 PM

Hi Shawn,

thanks for the insight into how the reloads are retried after a failure.

As far as partial load- what I have is a list of sessions with only the title and id populated for the initial list. Then if a user selects a session to see more detail - a request is made for all of the data. The 2 viewmodels are linked using a proxy.

I have a load error handler defined for each load request so I can display a message describing the timeout. I was thinking -- should I remove the item from the cache in the error handler there or is it even in the cache at that point?

I can send you code if that will help
Michael