feat(backend): added isOffline parameter to startRequest
This commit is contained in:
parent
9a84d1d8b6
commit
7284818af9
2 changed files with 5 additions and 1 deletions
|
|
@ -63,6 +63,9 @@ func (e *Router) readBody(w http.ResponseWriter, r *http.Request, limit int64) (
|
|||
|
||||
func getSessionTimestamp(req *StartSessionRequest, startTimeMili int64) (ts uint64) {
|
||||
ts = uint64(req.Timestamp)
|
||||
if req.IsOffline {
|
||||
return
|
||||
}
|
||||
c, err := semver.NewConstraint(">=4.1.6")
|
||||
if err != nil {
|
||||
return
|
||||
|
|
@ -78,7 +81,7 @@ func getSessionTimestamp(req *StartSessionRequest, startTimeMili int64) (ts uint
|
|||
}
|
||||
if c.Check(v) {
|
||||
ts = uint64(startTimeMili)
|
||||
if req.BufferDiff > 0 && req.BufferDiff < 3*60*1000 {
|
||||
if req.BufferDiff > 0 && req.BufferDiff < 5*60*1000 {
|
||||
ts -= req.BufferDiff
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ type StartSessionRequest struct {
|
|||
UserID string `json:"userID"`
|
||||
DoNotRecord bool `json:"doNotRecord"` // start record session or not
|
||||
BufferDiff uint64 `json:"bufferDiff"` // buffer diff in ms for start record session
|
||||
IsOffline bool `json:"isOffline"` // to indicate that we have to use user's start timestamp
|
||||
}
|
||||
|
||||
type StartSessionResponse struct {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue