diff --git a/backend/internal/http/router/handlers-web.go b/backend/internal/http/router/handlers-web.go index 895c94279..6cbf1a5f1 100644 --- a/backend/internal/http/router/handlers-web.go +++ b/backend/internal/http/router/handlers-web.go @@ -176,13 +176,14 @@ func (e *Router) startSessionHandlerWeb(w http.ResponseWriter, r *http.Request) e.addBeaconSize(tokenData.ID, p.BeaconSize) ResponseWithJSON(w, &StartSessionResponse{ - Token: e.services.Tokenizer.Compose(*tokenData), - UserUUID: userUUID, - SessionID: strconv.FormatUint(tokenData.ID, 10), - ProjectID: strconv.FormatUint(uint64(p.ProjectID), 10), - BeaconSizeLimit: e.getBeaconSize(tokenData.ID), - StartTimestamp: int64(flakeid.ExtractTimestamp(tokenData.ID)), - Delay: tokenData.Delay, + Token: e.services.Tokenizer.Compose(*tokenData), + UserUUID: userUUID, + SessionID: strconv.FormatUint(tokenData.ID, 10), + ProjectID: strconv.FormatUint(uint64(p.ProjectID), 10), + BeaconSizeLimit: e.getBeaconSize(tokenData.ID), + CompressionThreshold: e.getCompressionThreshold(), + StartTimestamp: int64(flakeid.ExtractTimestamp(tokenData.ID)), + Delay: tokenData.Delay, }, startTime, r.URL.Path, bodySize) } diff --git a/backend/internal/http/router/model.go b/backend/internal/http/router/model.go index b2ddfd9b4..fa6249ae7 100644 --- a/backend/internal/http/router/model.go +++ b/backend/internal/http/router/model.go @@ -15,14 +15,15 @@ type StartSessionRequest struct { } type StartSessionResponse struct { - Timestamp int64 `json:"timestamp"` - StartTimestamp int64 `json:"startTimestamp"` - Delay int64 `json:"delay"` - Token string `json:"token"` - UserUUID string `json:"userUUID"` - SessionID string `json:"sessionID"` - ProjectID string `json:"projectID"` - BeaconSizeLimit int64 `json:"beaconSizeLimit"` + Timestamp int64 `json:"timestamp"` + StartTimestamp int64 `json:"startTimestamp"` + Delay int64 `json:"delay"` + Token string `json:"token"` + UserUUID string `json:"userUUID"` + SessionID string `json:"sessionID"` + ProjectID string `json:"projectID"` + BeaconSizeLimit int64 `json:"beaconSizeLimit"` + CompressionThreshold int64 `json:"compressionThreshold"` } type NotStartedRequest struct { diff --git a/backend/internal/http/router/router.go b/backend/internal/http/router/router.go index 6cd7efe79..0b74c8c0b 100644 --- a/backend/internal/http/router/router.go +++ b/backend/internal/http/router/router.go @@ -66,6 +66,10 @@ func (e *Router) getBeaconSize(sessionID uint64) int64 { return e.cfg.BeaconSizeLimit } +func (e *Router) getCompressionThreshold() int64 { + return 20000 +} + func (e *Router) clearBeaconSizes() { for { time.Sleep(time.Minute * 2)