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

sending of prestaking snapshot messages #112

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ice-cronus
Copy link
Contributor

No description provided.

@ice-cronus ice-cronus marked this pull request as ready for review February 1, 2024 13:37
@ice-cronus ice-cronus requested a review from a team as a code owner February 1, 2024 13:37
@ice-cronus ice-cronus closed this Feb 1, 2024
@ice-cronus ice-cronus reopened this Feb 1, 2024
@@ -229,6 +234,8 @@ const (
totalCoinStatsCacheLockDuration = 1 * stdlibtime.Minute
)

var cfg Config
Copy link
Contributor

Choose a reason for hiding this comment

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

huh? use the one in repository. If u need it in miner, just add the topic as parameter to the function u call from miner to send the message


return multierror.Append(
sErr,
storage.Set(ctx, r.db, prestaking),
Copy link
Contributor

Choose a reason for hiding this comment

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

use a new context if u`re gonna rollback. Cuz most likely the reason message sending is gonna fail is cuz of exhausted retries => context expires

snapshot := &PreStakingSnapshot{
PreStakingSummary: newPrestaking,
}
if existingAllocation != 0 && existingBonus != 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

no. zero values is a valid before state

log.Panic(errors.Wrapf(err, "failed to marshal %#v", newPrestaking))

return &messagebroker.Message{
Headers: map[string]string{"producer": "freezer"},
Copy link
Contributor

Choose a reason for hiding this comment

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

move that into the func args. Its gonna be called with freezer-refrigerant or freezer-miner

return &messagebroker.Message{
Headers: map[string]string{"producer": "freezer"},
Key: newPrestaking.UserID,
Topic: cfg.MessageBroker.Topics[6].Name,
Copy link
Contributor

Choose a reason for hiding this comment

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

move it to arg as well

Copy link
Contributor

Choose a reason for hiding this comment

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

also, is [6] the last topic?

Copy link
Contributor Author

@ice-cronus ice-cronus Feb 1, 2024

Choose a reason for hiding this comment

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

Yes, on deployments repo I see 6 of them, last one is [5]

        topics:
          - name: freezer-refrigerant-health-check
          - name: adoption-table
          - name: mining-sessions-table
          - name: balances-table
          - name: available-daily-bonuses
          - name: started-days-off

@@ -55,8 +56,6 @@ func New(ctx context.Context, _ context.CancelFunc) Repository {
}

func StartProcessor(ctx context.Context, cancel context.CancelFunc) Processor {
var cfg Config
Copy link
Contributor

Choose a reason for hiding this comment

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

rollback changes in this file

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