Skip to content

Commit

Permalink
Merge pull request #37 from atomist-skills/ges-catchup
Browse files Browse the repository at this point in the history
async query is not no data
  • Loading branch information
rnorton5432 authored Jan 12, 2024
2 parents f78e24c + ab68ace commit 722ce55
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
7 changes: 6 additions & 1 deletion policy/goals/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ type (
}

GoalEvaluator interface {
EvaluateGoal(ctx context.Context, req skill.RequestContext, commonData CommonSubscriptionQueryResult, subscriptionResults [][]edn.RawMessage) ([]GoalEvaluationQueryResult, error)
EvaluateGoal(ctx context.Context, req skill.RequestContext, commonData CommonSubscriptionQueryResult, subscriptionResults [][]edn.RawMessage) (EvaluationResult, error)
}

EvaluationResult struct {
EvaluationCompleted bool
Result []GoalEvaluationQueryResult
}
)
9 changes: 8 additions & 1 deletion policy/policy_handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,19 @@ func (h EventHandler) evaluate(ctx context.Context, req skill.RequestContext, da
req.Log.Infof("Evaluating goal %s for digest %s ", goalName, digest)
evaluationTs := time.Now().UTC()

goalResults, err := evaluator.EvaluateGoal(ctx, req, commonResults, subscriptionResult)
evaluationResult, err := evaluator.EvaluateGoal(ctx, req, commonResults, subscriptionResult)
if err != nil {
req.Log.Errorf("Failed to evaluate goal %s for digest %s: %s", goal.Definition, digest, err.Error())
return skill.NewFailedStatus("Failed to evaluate goal")
}

if !evaluationResult.EvaluationCompleted {
req.Log.Info("evaluation incomplete")
return skill.NewCompletedStatus("Evaluation incomplete")
}

goalResults := evaluationResult.Result

for _, f := range h.transactFilters {
if !f(ctx, req) {
// if not transacting, we return results as part of the skill result
Expand Down

0 comments on commit 722ce55

Please sign in to comment.