Fix caching of /detail for modified reviewer lists
Rely only on ETag for change entity caching. The Last-Modified value was derived from the lastUpdatedOn property, which is not always modified when children are updated. When adding or removing reviewers from a change perform a no-op modification of the Change entity. This bumps its rowVersion as a side-effect of the database mutation, causing the ETag to be different on the next read. Change-Id: If480f92b419041e7d62839ab12211058e78f828f
This commit is contained in:
		| @@ -16,16 +16,12 @@ package com.google.gerrit.server.change; | ||||
|  | ||||
| import com.google.gerrit.extensions.restapi.RestResource; | ||||
| import com.google.gerrit.extensions.restapi.RestResource.HasETag; | ||||
| import com.google.gerrit.extensions.restapi.RestResource.HasLastModified; | ||||
| import com.google.gerrit.extensions.restapi.RestView; | ||||
| import com.google.gerrit.reviewdb.client.Change; | ||||
| import com.google.gerrit.server.project.ChangeControl; | ||||
| import com.google.inject.TypeLiteral; | ||||
|  | ||||
| import java.sql.Timestamp; | ||||
|  | ||||
| public class ChangeResource implements RestResource, | ||||
|     HasLastModified, HasETag { | ||||
| public class ChangeResource implements RestResource, HasETag { | ||||
|   public static final TypeLiteral<RestView<ChangeResource>> CHANGE_KIND = | ||||
|       new TypeLiteral<RestView<ChangeResource>>() {}; | ||||
|  | ||||
| @@ -47,11 +43,6 @@ public class ChangeResource implements RestResource, | ||||
|     return getControl().getChange(); | ||||
|   } | ||||
|  | ||||
|   @Override | ||||
|   public Timestamp getLastModified() { | ||||
|     return getChange().getLastUpdatedOn(); | ||||
|   } | ||||
|  | ||||
|   @Override | ||||
|   public String getETag() { | ||||
|     return String.format("%x-%x", | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Shawn Pearce
					Shawn Pearce