Skip to content

Commit

Permalink
Merge pull request #179 from matrix-org/dmr/setupConnection-debugging
Browse files Browse the repository at this point in the history
make setupConnection a task
  • Loading branch information
David Robertson committed Jun 21, 2023
2 parents fc1fce5 + 8b938b8 commit b48ce3d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sync3/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ func (h *SyncLiveHandler) serve(w http.ResponseWriter, req *http.Request) error
// When this function returns, the connection is alive and active.

func (h *SyncLiveHandler) setupConnection(req *http.Request, syncReq *sync3.Request, containsPos bool) (*sync3.Conn, *internal.HandlerError) {
taskCtx, task := internal.StartTask(req.Context(), "setupConnection")
defer task.End()
var conn *sync3.Conn
// Extract an access token
accessToken, err := internal.ExtractAccessToken(req)
Expand Down Expand Up @@ -333,6 +335,7 @@ func (h *SyncLiveHandler) setupConnection(req *http.Request, syncReq *sync3.Requ
}
}
log := hlog.FromRequest(req).With().Str("user", token.UserID).Str("device", token.DeviceID).Logger()
internal.Logf(taskCtx, "setupConnection", "identified access token as user=%s device=%s", token.UserID, token.DeviceID)

// Record the fact that we've recieved a request from this token
err = h.V2Store.TokensTable.MaybeUpdateLastSeen(token, time.Now())
Expand Down

0 comments on commit b48ce3d

Please sign in to comment.