Skip to content
Snippets Groups Projects
Commit 3b31727f authored by Malte Bauch's avatar Malte Bauch Committed by Fabian Seidl
Browse files

Add timeout within ksaReqHandler

See merge request !141
parent e11638c9
No related branches found
No related tags found
1 merge request!141Add timeout within ksaReqHandler
Pipeline #201867 passed
......@@ -15,8 +15,6 @@ require (
github.com/prometheus/procfs v0.15.1
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.9.0
golang.org/x/sys v0.21.0
google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117
......@@ -28,33 +26,18 @@ require (
require (
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.33.0-20240221180331-f05a6f4403ce.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/golang/glog v1.2.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tklauser/go-sysconf v0.3.13 // indirect
github.com/tklauser/numcpus v0.7.0 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/text v0.15.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
)
This diff is collapsed.
......@@ -2,7 +2,9 @@ package server
import (
"encoding/json"
"fmt"
"net/http"
"time"
"code.fbi.h-da.de/danet/quant/goKMS/kms/event"
"github.com/google/uuid"
......@@ -82,7 +84,14 @@ func ksaReqHandler(eventBus *event.EventBus, receiver *Receiver, generateAndSend
return
}
<-receiverChan
select {
case <-receiverChan:
case <-time.After(20 * time.Second):
http.Error(w, fmt.Sprintf("Platform Key exchange failed for RequestID: %s", kmsKeyRequest.RequestID), http.StatusInternalServerError)
logrus.Errorf("Platform Key exchange failed for RequestID: %s", kmsKeyRequest.RequestID)
return
}
err = generateAndSend(kmsKeyRequest.ReceivingCKMSID, pathId, kmsKeyRequest.RequestID, kmsKeyRequest.KeyProperties.Number)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment