Skip to content

Commit

Permalink
added logic to print logs for pause and resume triggers (#285)
Browse files Browse the repository at this point in the history
Co-authored-by: “jdattatr-tibco” <“[email protected]”>
  • Loading branch information
jdattatr-tibco and “jdattatr-tibco” authored Jan 15, 2024
1 parent 42ea819 commit 70a08c4
Showing 1 changed file with 18 additions and 23 deletions.
41 changes: 18 additions & 23 deletions app/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,42 +79,37 @@ func (a *App) initEventFlowController() {
// Start triggers
func (c *controllerData) resumeTriggers() error {
// Resume triggers
logger.Info("Resuming Triggers...")
for id, trg := range c.triggers {
var err error
if flowControlAware, ok := trg.(trigger.EventFlowControlAware); ok {
err = flowControlAware.Resume()
logger.Info("Resuming Triggers...")
err := flowControlAware.Resume()
if err != nil {
//return err
//TODO Starting other triggers. Should we stop the app here?
logger.Errorf("Trigger [%s] failed to resume due to error - %s.", id, err.Error())
continue
}
logger.Infof("Trigger [%s] is resumed.", id)
}

if err != nil {
//return err
//TODO Starting other triggers. Should we stop the app here?
logger.Errorf("Trigger [%s] failed to resume due to error - %s.", id, err.Error())
continue
}
logger.Infof("Trigger [%s] is resumed.", id)
}
logger.Info("Triggers are resumed")
return nil
}

// Stop triggers
func (c *controllerData) pauseTriggers() error {
logger.Info("Pausing Triggers...")
// Pause Triggers
for id, trg := range c.triggers {
var err error
if flowControlAware, ok := trg.(trigger.EventFlowControlAware); ok {
err = flowControlAware.Pause()
}
if err != nil {
//return err
//TODO Stopping other triggers. Should we stop the app here?
logger.Errorf("Trigger [%s] failed to pause due to error - %s.", id, err.Error())
continue
logger.Info("Pausing Triggers...")
err := flowControlAware.Pause()
if err != nil {
//return err
//TODO Stopping other triggers. Should we stop the app here?
logger.Errorf("Trigger [%s] failed to pause due to error - %s.", id, err.Error())
continue
}
logger.Infof("Trigger [%s] is paused.", id)
}
logger.Infof("Trigger [%s] is paused.", id)
}
logger.Info("Triggers are paused")
return nil
}

0 comments on commit 70a08c4

Please sign in to comment.