Skip to content

Commit

Permalink
BUG/MEDIUM: parser: fix: concurrent map iteration and map write
Browse files Browse the repository at this point in the history
  • Loading branch information
huangnauh committed Aug 6, 2024
1 parent ee8db30 commit d89e2fc
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion configuration/transaction-handling.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,22 @@ func (c *client) InitTransactionParsers() error {
return nil
}

// GetParserTransactionIDs returns parser transactionIDs
func (c *client) GetParserTransactionIDs() []string {
transactionIDs := []string{}
c.clientMu.Lock()
defer c.clientMu.Unlock()
for tID := range c.parsers {
transactionIDs = append(transactionIDs, tID)
}
return transactionIDs
}

// GetParserTransactions returns parser transactions
func (c *client) GetParserTransactions() models.Transactions {
transactions := models.Transactions{}
for tID := range c.parsers {
transactionIDs := c.GetParserTransactionIDs()
for _, tID := range transactionIDs {
v, err := c.GetVersion(tID)
if err == nil {
t := &models.Transaction{
Expand Down

0 comments on commit d89e2fc

Please sign in to comment.