Skip to content

Ability to tell loop iteration in retries.Info #251

@pietern

Description

@pietern

This came up in a separate discussion. It would be nice to support (a subset of) the following pattern out of the box.

var prevState *jobs.RunState

// This function is called each time the function below polls the run status.
update := func(info *retries.Info[jobs.Run]) {
  state := info.Info.State
  if state == nil {
    return
  }
  if prevState == nil {
    // First iteration
  }
  if prevState == nil || prevState.LifeCycleState != state.LifeCycleState {
    log.Printf("%s Run status: %s", prefix, info.Info.State.LifeCycleState)
    prevState = state
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions