You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicecomb.apache.org by GitBox <gi...@apache.org> on 2018/01/11 02:47:12 UTC

[GitHub] seanyinx commented on a change in pull request #111: SCB-213 proper timing to handle SagaEndedEvent in asynchronous situation

seanyinx commented on a change in pull request #111: SCB-213 proper timing to handle SagaEndedEvent in asynchronous situation
URL: https://github.com/apache/incubator-servicecomb-saga/pull/111#discussion_r160852220
 
 

 ##########
 File path: alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/TxConsistentService.java
 ##########
 @@ -44,7 +58,32 @@ public void handle(TxEvent event) {
   }
 
   private void compensate(TxEvent event) {
-    List<TxEvent> events = eventRepository.findStartedTransactions(event.globalTxId(), EventType.TxStartedEvent.name());
+    List<TxEvent> events = eventRepository.findStartedTransactions(event.globalTxId(), TxStartedEvent.name());
     events.forEach(omegaCallback::compensate);
+    eventsToCompensate.computeIfAbsent(event.globalTxId(), (v) -> {
+      CopyOnWriteArraySet<String> eventSet = new CopyOnWriteArraySet<>();
+      events.forEach(e -> eventSet.add(getUniqueEventId(e)));
 
 Review comment:
   what's the performance characteristics of CopyOnWrite?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services