Skip to content

Commit

Permalink
Merge branch 'master' into do_not_expose_debug
Browse files Browse the repository at this point in the history
  • Loading branch information
sawadashota authored Mar 29, 2022
2 parents 6a76e95 + b85c0e6 commit e1fec05
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**

- [ (2022-03-28)](#2022-03-28)
- [ (2022-03-29)](#2022-03-29)
- [Bug Fixes](#bug-fixes)
- [Features](#features)
- [Tests](#tests)
Expand Down Expand Up @@ -248,7 +248,7 @@

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

# [](https://github.com/ory/kratos/compare/v0.9.0-alpha.3...v) (2022-03-28)
# [](https://github.com/ory/kratos/compare/v0.9.0-alpha.3...v) (2022-03-29)


### Bug Fixes
Expand All @@ -257,6 +257,7 @@

The default mode is 0644, which is allows broader access than necessary.

* **courier:** Add ability to specify backoff ([#2349](https://github.com/ory/kratos/issues/2349)) ([bf970f3](https://github.com/ory/kratos/commit/bf970f32f571164b8081f09f602a3473e079194e))
* Load return_to and append to errors ([#2333](https://github.com/ory/kratos/issues/2333)) ([5efe4a3](https://github.com/ory/kratos/commit/5efe4a33e35e74d248d4eec43dc901b7b6334037)), closes [#2275](https://github.com/ory/kratos/issues/2275) [#2279](https://github.com/ory/kratos/issues/2279) [#2285](https://github.com/ory/kratos/issues/2285)
* Refresh is always false when session exists ([d3436d7](https://github.com/ory/kratos/commit/d3436d7fa17589d91e25c9f0bd66bc3bb5b150fa)), closes [#2341](https://github.com/ory/kratos/issues/2341)

Expand Down
10 changes: 9 additions & 1 deletion courier/courier.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type (
DispatchMessage(ctx context.Context, msg Message) error
SetGetEmailTemplateType(f func(t EmailTemplate) (TemplateType, error))
SetNewEmailTemplateFromMessage(f func(d template.Dependencies, msg Message) (EmailTemplate, error))
UseBackoff(b backoff.BackOff)
}

Provider interface {
Expand All @@ -47,6 +48,7 @@ type (
smtpClient *smtpClient
deps Dependencies
failOnError bool
backoff backoff.BackOff
}
)

Expand All @@ -55,6 +57,7 @@ func NewCourier(ctx context.Context, deps Dependencies) Courier {
smsClient: newSMS(ctx, deps),
smtpClient: newSMTP(ctx, deps),
deps: deps,
backoff: backoff.NewExponentialBackOff(),
}
}

Expand All @@ -79,11 +82,16 @@ func (c *courier) Work(ctx context.Context) error {
}
}

func (c *courier) UseBackoff(b backoff.BackOff) {
c.backoff = b
}

func (c *courier) watchMessages(ctx context.Context, errChan chan error) {
c.backoff.Reset()
for {
if err := backoff.Retry(func() error {
return c.DispatchQueue(ctx)
}, backoff.NewExponentialBackOff()); err != nil {
}, c.backoff); err != nil {
errChan <- err
return
}
Expand Down

0 comments on commit e1fec05

Please sign in to comment.