-
Notifications
You must be signed in to change notification settings - Fork 11
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
base: master
Are you sure you want to change the base?
Conversation
tokenomics/contract.go
Outdated
@@ -229,6 +234,8 @@ const ( | |||
totalCoinStatsCacheLockDuration = 1 * stdlibtime.Minute | |||
) | |||
|
|||
var cfg Config |
There was a problem hiding this comment.
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
tokenomics/pre_staking.go
Outdated
|
||
return multierror.Append( | ||
sErr, | ||
storage.Set(ctx, r.db, prestaking), |
There was a problem hiding this comment.
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
tokenomics/pre_staking.go
Outdated
snapshot := &PreStakingSnapshot{ | ||
PreStakingSummary: newPrestaking, | ||
} | ||
if existingAllocation != 0 && existingBonus != 0 { |
There was a problem hiding this comment.
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
tokenomics/pre_staking.go
Outdated
log.Panic(errors.Wrapf(err, "failed to marshal %#v", newPrestaking)) | ||
|
||
return &messagebroker.Message{ | ||
Headers: map[string]string{"producer": "freezer"}, |
There was a problem hiding this comment.
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
tokenomics/pre_staking.go
Outdated
return &messagebroker.Message{ | ||
Headers: map[string]string{"producer": "freezer"}, | ||
Key: newPrestaking.UserID, | ||
Topic: cfg.MessageBroker.Topics[6].Name, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
tokenomics/tokenomics.go
Outdated
@@ -55,8 +56,6 @@ func New(ctx context.Context, _ context.CancelFunc) Repository { | |||
} | |||
|
|||
func StartProcessor(ctx context.Context, cancel context.CancelFunc) Processor { | |||
var cfg Config |
There was a problem hiding this comment.
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
No description provided.