Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load balance email clients #153

Merged
merged 4 commits into from
Jun 20, 2024
Merged

load balance email clients #153

merged 4 commits into from
Jun 20, 2024

Conversation

ice-cronus
Copy link
Contributor

No description provided.

@ice-cronus ice-cronus requested a review from a team as a code owner June 20, 2024 11:01
@@ -128,16 +129,16 @@ func (c *client) sendNotifyEmailChanged(ctx context.Context, notifyEmail, newEma
}{
AppName: c.cfg.AppName,
}

return errors.Wrapf(c.emailClient.Send(ctx, &email.Parcel{
from := c.fromRecipients[atomic.AddUint64(&c.emailClientLBIndex, 1)%uint64(len(c.emailClients))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract the idx in a var cuz otherwise u'll have 2 different ones for fromRecipients and clients

db: db,
authClient: authClient,
userModifier: userModifier,
emailClients: make([]email.Client, 0),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0, cfg.Extra...

authClient: authClient,
userModifier: userModifier,
emailClients: make([]email.Client, 0),
fromRecipients: make([]fromRecipient, 0),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0, cfg.Extra...


return errors.Wrapf(c.emailClient.Send(ctx, &email.Parcel{
return errors.Wrapf(c.emailClients[atomic.AddUint64(&c.emailClientLBIndex, 1)%uint64(len(c.emailClients))].Send(ctx, &email.Parcel{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here

db: db,
authClient: authClient,
userModifier: userModifier,
emailClients: make([]email.Client, 0, cfg.ExtraLoadBalancersCount),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually its Extra+1

@ice-ares ice-ares merged commit 707cfbc into master Jun 20, 2024
19 checks passed
@ice-ares ice-ares deleted the feature/lb_email branch June 20, 2024 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants