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

chore(transactor): Allow async forcing tx requests #119

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion baseapp/runners.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func (jm *JobManager) retryableHeaderSubscriber(
// Handle error while subscribing.
if shouldRetry = (err != nil); shouldRetry {
jm.Logger(ctx).Error(
"error subscribing to filter logs, retrying...",
"error subscribing to block headers, retrying...",
"job", blockHeaderJob.RegistryKey(), "err", err,
)
return shouldRetry
Expand Down
24 changes: 18 additions & 6 deletions core/transactor/transactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,28 @@ func (t *TxrV2) SendTxRequest(txReq *types.Request) (string, error) {
// ForceTxRequest immediately (whenever the sender is free from any previous sends) builds and
// sends the tx request to the chain, after validating it.
// NOTE: this bypasses the queue and batching even if configured to do so.
func (t *TxrV2) ForceTxRequest(ctx context.Context, txReq *types.Request) (string, error) {
func (t *TxrV2) ForceTxRequest(ctx context.Context, txReq *types.Request, async bool) (string, error) {
if err := txReq.Validate(); err != nil {
return "", err
}

go t.fire(
ctx,
&tracker.Response{MsgIDs: []string{txReq.MsgID}, InitialTimes: []time.Time{txReq.Time()}},
true, txReq.CallMsg,
)
if async {
go t.fire(
ctx,
&tracker.Response{
MsgIDs: []string{txReq.MsgID}, InitialTimes: []time.Time{txReq.Time()},
},
true, txReq.CallMsg,
)
} else {
t.fire(
ctx,
&tracker.Response{
MsgIDs: []string{txReq.MsgID}, InitialTimes: []time.Time{txReq.Time()},
},
true, txReq.CallMsg,
)
}
return txReq.MsgID, nil
}

Expand Down
2 changes: 0 additions & 2 deletions x/jobs/block_header_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ func (w *BlockHeaderWatcher) Subscribe(
return nil, nil, err
}
w.sub = sub

sCtx.Logger().Info("Subscribed to new block headers")
return sub, headerCh, nil
}

Expand Down
Loading