Reread ChangeData in email constructors
Email processing is often kicked off into a background thread, so it is not safe to use the non-threadsafe accessors of Change. Rework the ChangeEmail hierarchy so a new ChangeData is created in each constructor, which ensures data is reread in a background thread. This is a little slow, particularly as not all emails are sent async, but is the best way we have of guaranteeing safety. It is also a little ugly as the destination project/branch need to be passed to a super constructor, and we can't have a statement creating this new ChangeData prior to the super call, so the ChangeData needs to be explicitly created in each leaf type. Change-Id: Ibc549791e5cb2a23fbc4d7acca96589782757296
This commit is contained in:
@@ -244,7 +244,7 @@ public class ChangeInserter {
|
||||
public void run() {
|
||||
try {
|
||||
CreateChangeSender cm =
|
||||
createChangeSenderFactory.create(change);
|
||||
createChangeSenderFactory.create(change.getId());
|
||||
cm.setFrom(change.getOwner());
|
||||
cm.setPatchSet(patchSet, patchSetInfo);
|
||||
cm.addReviewers(reviewers);
|
||||
|
||||
Reference in New Issue
Block a user