Skip to content

Commit

Permalink
Merge pull request #740 from onflow/mpeter/fix-available-signing-keys…
Browse files Browse the repository at this point in the history
…-metric

Move recording of available-signing-keys metric inside a deferred function
  • Loading branch information
m-Peter authored Feb 11, 2025
2 parents 38694b7 + ae8b9c7 commit fad9132
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ EMULATOR_ARGS := --flow-network-id=flow-emulator \
--log-writer=console \
--tx-state-validation=local-index \
--profiler-enabled=true \
--profiler-port=6060 \
--tx-state-validation=local-index
--profiler-port=6060

# Set VERSION from command line, environment, or default to SHORT_COMMIT
VERSION ?= $(SHORT_COMMIT)
Expand Down
1 change: 1 addition & 0 deletions api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ type responseHandler struct {
}

var knownErrors = []error{
errs.ErrInternal,
errs.ErrRateLimit,
errs.ErrInvalid,
errs.ErrFailedTransaction,
Expand Down
6 changes: 4 additions & 2 deletions services/requester/requester.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ func (e *EVM) SendRawTransaction(ctx context.Context, data []byte) (common.Hash,
script := replaceAddresses(runTxScript, e.config.FlowNetworkID)
flowTx, err := e.buildTransaction(ctx, script, hexEncodedTx, coinbaseAddress)
if err != nil {
e.logger.Error().Err(err).Str("data", txData).Msg("failed to build transaction")
return common.Hash{}, err
}

Expand Down Expand Up @@ -569,6 +568,10 @@ func (e *EVM) buildTransaction(
e.mux.Lock()
defer e.mux.Unlock()

defer func() {
e.collector.AvailableSigningKeys(e.keystore.AvailableKeys())
}()

var (
g = errgroup.Group{}
err1, err2 error
Expand Down Expand Up @@ -609,7 +612,6 @@ func (e *EVM) buildTransaction(
}
e.keystore.LockKey(flowTx.ID(), latestBlock.Height, accKey)

e.collector.AvailableSigningKeys(e.keystore.AvailableKeys())
e.collector.OperatorBalance(account)

return flowTx, nil
Expand Down

0 comments on commit fad9132

Please sign in to comment.