From 3d9c786c236a781d330ed81843d59ac6807b8630 Mon Sep 17 00:00:00 2001 From: insider-automation <117348511+insider-automation@users.noreply.github.com> Date: Sat, 14 Sep 2024 00:23:12 +0300 Subject: [PATCH 1/2] new workflow added --- .github/workflows/security_allinone.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/security_allinone.yml diff --git a/.github/workflows/security_allinone.yml b/.github/workflows/security_allinone.yml new file mode 100644 index 0000000..b611631 --- /dev/null +++ b/.github/workflows/security_allinone.yml @@ -0,0 +1,22 @@ +name: Security AllInOne +on: + push: + branches: '**' + pull_request: + types: + - opened + - closed + - ready_for_review +jobs: + build: + runs-on: + group: default + labels: self-hosted + steps: + - name: Trigger to Insider Security + run: | + curl -X POST -H "Content-Type: application/json" \ + -d '{"type": "security-allinone", "version": "v1", "repository": "${{ github.event.repository.name }}", "ref": "${{ github.head_ref || github.ref_name }}", "event_name": "${{ github.event_name }}", "event_action": "${{ github.event.action }}", "default_branch": "${{ github.event.repository.default_branch }}"}' \ + $INSECPROXY_HOOK + env: + INSECPROXY_HOOK: ${{ secrets.INSECPROXY_HOOK }} \ No newline at end of file From 1101d98d544c74fd8c07ada51ab2af4ca59e9094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafet=20Top=C3=A7u?= <44340673+rafet@users.noreply.github.com> Date: Wed, 25 Sep 2024 13:11:55 +0300 Subject: [PATCH 2/2] PA-25476 Retry Connection Reset Error (#38) --- inskinesis/customretryer.go | 24 ++++++++++++++++++++++++ inskinesis/inskinesis.go | 7 +++++++ 2 files changed, 31 insertions(+) create mode 100644 inskinesis/customretryer.go diff --git a/inskinesis/customretryer.go b/inskinesis/customretryer.go new file mode 100644 index 0000000..655abc4 --- /dev/null +++ b/inskinesis/customretryer.go @@ -0,0 +1,24 @@ +package inskinesis + +import ( + "github.com/aws/aws-sdk-go/aws/request" + "net" + "strings" +) + +// CustomRetryer retries on "connection reset by peer" +type CustomRetryer struct { + request.Retryer +} + +func (r CustomRetryer) ShouldRetry(req *request.Request) bool { + if err, ok := req.Error.(net.Error); ok && err.Timeout() { + return true + } + + if opErr, ok := req.Error.(*net.OpError); ok && strings.Contains(opErr.Err.Error(), "connection reset by peer") { + return true + } + + return r.Retryer.ShouldRetry(req) +} diff --git a/inskinesis/inskinesis.go b/inskinesis/inskinesis.go index 19ebec2..2662239 100644 --- a/inskinesis/inskinesis.go +++ b/inskinesis/inskinesis.go @@ -4,6 +4,7 @@ import ( "encoding/json" "errors" "fmt" + "github.com/aws/aws-sdk-go/aws/client" "math" "sync" "time" @@ -94,6 +95,12 @@ func NewKinesis(config Config) (StreamInterface, error) { return nil, err } + awsSession.Config.Retryer = CustomRetryer{ + Retryer: client.DefaultRetryer{ + NumMaxRetries: 3, + }, + } + kinesisClient := kinesis.New(awsSession) s := &stream{