Skip to content
Merged
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
10 changes: 7 additions & 3 deletions parcs/parcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ import (
"github.com/sil-org/pipedream-go/ssh"
)

const MaxConcurrent = 5 // change this to adjust concurrency
// MaxConcurrent sets the number of concurrent transaction updates. Setting higher than 5 may cause a concurrency
// limit error: "Concurrent request limit exceeded. Request blocked. Verify your concurrency limits at Setup >
// Integration > Integration Management > Integration Governance."
const MaxConcurrent = 5

Choose a reason for hiding this comment

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

where is this referenced?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the first line of MarkTransactionsSent, a channel list is created to manage the goroutines.

func MarkTransactionsSent(ctx context.Context, transactions []Transaction, cfg Config) error {
	sem := make(chan struct{}, min(len(transactions), MaxConcurrent))


const (
CashRefund = "CashRfnd"
Expand Down Expand Up @@ -339,8 +342,6 @@ func MarkTransactionsSent(ctx context.Context, transactions []Transaction, cfg C
defer wg.Done()
defer func() { <-sem }()

log.Printf("updating NetSuite transaction %v", t.NetSuiteID)

url, err := transactionURL(t.NetSuiteID, t.TranType, cfg.NetSuiteRealm)
if err != nil {
errCh <- err
Expand All @@ -351,7 +352,10 @@ func MarkTransactionsSent(ctx context.Context, transactions []Transaction, cfg C

if err := httpRequest(cfg.client, http.MethodPatch, url, requestBody); err != nil {
errCh <- fmt.Errorf("failed to update %v transaction %v: %w", t.TranType, t.NetSuiteID, err)
return
}

log.Printf("updated NetSuite transaction %v", t.NetSuiteID)
}(t)
}

Expand Down