Make reaction available when retrieving output from trigger.
[rhynodge.git] / src / main / java / net / pterodactylus / reactor / engine / Engine.java
index 2825b54..f14d3d7 100644 (file)
@@ -125,7 +125,7 @@ public class Engine extends AbstractExecutionThreadService {
                                reactionName = nextReactions.get(nextReactions.firstKey()).getLeft();
                                nextReaction = nextReactions.get(nextReactions.firstKey()).getRight();
                        }
-                       logger.debug(String.format("Next Reaction: %s.", nextReaction));
+                       logger.debug(String.format("Next Reaction: %s.", reactionName));
 
                        /* wait until the next reaction has to run. */
                        net.pterodactylus.reactor.State lastState = stateManager.loadLastState(reactionName);
@@ -136,7 +136,7 @@ public class Engine extends AbstractExecutionThreadService {
                        if (waitTime > 0) {
                                synchronized (reactions) {
                                        try {
-                                               logger.debug(String.format("Waiting for %d milliseconds.", waitTime));
+                                               logger.info(String.format("Waiting until %tc.", lastStateTime + nextReaction.updateInterval()));
                                                reactions.wait(waitTime);
                                        } catch (InterruptedException ie1) {
                                                /* we’re looping! */
@@ -192,7 +192,7 @@ public class Engine extends AbstractExecutionThreadService {
                        logger.debug(String.format("Trigger was hit: %s.", triggerHit));
                        if (triggerHit) {
                                logger.info("Executing Action...");
-                               nextReaction.action().execute(trigger.output());
+                               nextReaction.action().execute(trigger.output(nextReaction));
                        }
 
                }