feat(backend): added compression threshold to start request
This commit is contained in:
parent
33fbdb149f
commit
05e47e978b
3 changed files with 21 additions and 15 deletions
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue