ChangedFiles: Check experiment flag only when current user is available

Checking whether the experiment flag for using the diff cache is set
requires a current user, at least with the Google implementation of
experiment flags. If a current user is not available a warning is logged
and the experiment flag is considered as not set. Since ChangedFiles is
called from a background thread regularly (e.g. when indexing a change)
we see this warning frequently. Fix this by checking for the experiment
flag only when a current user is available, otherwise return false to
not use the diff cache in this case.

Alternatively it was considered to make a current user available by
opening a ManualRequestContext, but we don't have a suitable user
available that should be provided as current user and providing the
internal user would always evaluate to false, since experiment flags are
never set for the internal user. This means we better directly return
false in this case.

Bug: Google b/191961988
Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: Ia0359f5e8ea661df734b53739772e4b2282e2bcc
1 file changed
tree: 34a65cc24f3dde8f32c6c2260d81df67eaba5f61
  1. java/
  2. javatests/
  3. proto/
  4. resources/
  5. test/
  6. ui/
  7. .eslintrc.json
  8. .gitignore
  9. .gitreview
  10. bower.json
  11. BUILD
  12. LICENSE
  13. package-lock.json
  14. package.json
  15. README.md
README.md

Gerrit Code Review code-owners plugin

This plugin provides support for defining code owners for files in a repository.

If the code-owners plugin is enabled, changes can only be submitted if all touched files are covered by approvals from code owners.

Also see resources/Documentation/about.md.

IMPORTANT: Before installing/enabling the plugin follow the instructions from the setup guide, see resources/Documentation/setup-guide.md.