Repository: aurora
Updated Branches:
  refs/heads/master 4fecf1f59 -> 89b0fa9b2


Use transition method and fix documentation in Webhooks

Reviewed at https://reviews.apache.org/r/63705/


Project: http://git-wip-us.apache.org/repos/asf/aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/89b0fa9b
Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/89b0fa9b
Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/89b0fa9b

Branch: refs/heads/master
Commit: 89b0fa9b2cbe3f7dc0e514bf32f3077eb62f9778
Parents: 4fecf1f
Author: Jordan Ly <[email protected]>
Authored: Tue Nov 14 17:42:50 2017 -0800
Committer: Bill Farner <[email protected]>
Committed: Tue Nov 14 17:42:50 2017 -0800

----------------------------------------------------------------------
 .../java/org/apache/aurora/scheduler/events/Webhook.java     | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/89b0fa9b/src/main/java/org/apache/aurora/scheduler/events/Webhook.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/events/Webhook.java 
b/src/main/java/org/apache/aurora/scheduler/events/Webhook.java
index 2af8118..95e3f52 100644
--- a/src/main/java/org/apache/aurora/scheduler/events/Webhook.java
+++ b/src/main/java/org/apache/aurora/scheduler/events/Webhook.java
@@ -92,10 +92,10 @@ public class Webhook extends AbstractIdleService implements 
EventSubscriber {
   @Subscribe
   public void taskChangedState(TaskStateChange stateChange) {
     LOG.debug("Got an event: {}", stateChange);
-    // Old state is not present because a scheduler just failed over. In that 
case we do not want to
-    // resend the entire state. This check also ensures that only whitelisted 
statuses will be sent
-    // to the configured endpoint.
-    if (stateChange.getOldState().isPresent() && 
isWhitelisted.apply(stateChange.getNewState())) {
+    // Ensure that this state change event is a transition, and not an event 
from when the scheduler
+    // first initializes. In that case we do not want to resend the entire 
state. This check also
+    // ensures that only whitelisted statuses will be sent to the configured 
endpoint.
+    if (stateChange.isTransition() && 
isWhitelisted.apply(stateChange.getNewState())) {
       attemptsCounter.incrementAndGet();
       try {
         // We don't care about the response body, so only listen for the HTTP 
status code.

Reply via email to