google-cloud-eclipse icon indicating copy to clipboard operation
google-cloud-eclipse copied to clipboard

Cache project query result

Open akerekes opened this issue 8 years ago • 5 comments

Databinding can trigger several queries very quickly, which in a slower connection could cause bad UX so we could add a caching mechanism to the project retrieval logic. This cache would be refreshed whenever the user clicks on the Refresh button or when we explicitly want to trigger it.

akerekes avatar Feb 09 '17 17:02 akerekes

Just to be sure, the project selector itself is independent of databinding (like the current AccountSelector), right? It's the deploy preferences that will want to wire up databinding, right?

chanseokoh avatar Feb 09 '17 17:02 chanseokoh

Currently the project selector depends on another class to provide the list of projects like a repository, and the caching could be added to this repository. But the project selector is not even in PR so things may change.

akerekes avatar Feb 09 '17 17:02 akerekes

Another question: if we hadn't used databinding, can we avoid introducing this caching? Or, will this caching still be desired even in the absent of databiniding?

chanseokoh avatar Feb 09 '17 18:02 chanseokoh

I haven't investigated it as currently databinding saves us from writing a lot of code.

akerekes avatar Feb 09 '17 19:02 akerekes

The two calls to projectRepository.getProjects():

  • when databinding is added to the account selector, the selection change listener triggers the project list query corresponding to the account selected
  • to display validation errors when we open the dialog, we call DataBindingContext.updateTargets() which while triggers the validation and in case of error the error message to be displayed, but also triggers the querying of the project list.

We may be able to avoid the second query if the account selector only fires the selection changed event if there's a change to the selection.

akerekes avatar Feb 22 '17 22:02 akerekes