You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes want to retry if the computed values does not satisfy certain conditions. For example, you are waiting for some change to be applied to a persisted entity, so you want to retry until the entity read from persistence satisfy certain condition.
Example:
func (h*Handler) waitForApproval(ctx context.Context, id ids.Id) (*Entity, error) {
returnretry.DoWithData(func() (*Entity, error) {
returnh.reader.FindById(ctx, id)
}, retry.RetryIfData(func (e*Entity) bool {
returne.Status!=StatusApproved// retry if the Status is not approved
})
}
Sometimes want to retry if the computed values does not satisfy certain conditions. For example, you are waiting for some change to be applied to a persisted entity, so you want to retry until the entity read from persistence satisfy certain condition.
Example:
New type and func:
It is challenging to handle type for Options to ensure consistency.
If you consider this to be useful (for me it is), I can provide a PR.
The text was updated successfully, but these errors were encountered: