mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-26 08:13:09 -06:00
Log tweaks, typing fixed?
This commit is contained in:
parent
9ead2d96e2
commit
a588f9061b
|
|
@ -79,6 +79,7 @@ func (p *PDUStreamProvider) CompleteSync(
|
|||
return to
|
||||
}
|
||||
req.Response.Rooms.Join[roomID] = *jr
|
||||
req.Rooms[roomID] = gomatrixserverlib.Join
|
||||
}
|
||||
|
||||
// Add peeked rooms.
|
||||
|
|
|
|||
|
|
@ -16,7 +16,10 @@ func (p *TypingStreamProvider) CompleteSync(
|
|||
ctx context.Context,
|
||||
req *types.SyncRequest,
|
||||
) types.StreamPosition {
|
||||
return p.IncrementalSync(ctx, req, 0, p.LatestPosition(ctx))
|
||||
// It isn't beneficial to send previous typing notifications
|
||||
// after a complete sync, so just return the latest position
|
||||
// and otherwise do nothing.
|
||||
return p.LatestPosition(ctx)
|
||||
}
|
||||
|
||||
func (p *TypingStreamProvider) IncrementalSync(
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import (
|
|||
userapi "github.com/matrix-org/dendrite/userapi/api"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
"github.com/matrix-org/util"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
const defaultSyncTimeout = time.Duration(0)
|
||||
|
|
@ -74,10 +75,20 @@ func newSyncRequest(req *http.Request, device userapi.Device, syncDB storage.Dat
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Additional query params: set_presence, filter
|
||||
|
||||
logger := util.GetLogger(req.Context()).WithFields(logrus.Fields{
|
||||
"user_id": device.UserID,
|
||||
"device_id": device.ID,
|
||||
"since": since,
|
||||
"timeout": timeout,
|
||||
"limit": timelineLimit,
|
||||
})
|
||||
|
||||
return &types.SyncRequest{
|
||||
Context: req.Context(), //
|
||||
Log: logger, //
|
||||
Device: &device, //
|
||||
Response: types.NewResponse(), // Populated by all streams
|
||||
Filter: gomatrixserverlib.DefaultEventFilter(), //
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ import (
|
|||
userapi "github.com/matrix-org/dendrite/userapi/api"
|
||||
"github.com/matrix-org/util"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// RequestPool manages HTTP long-poll connections for /sync
|
||||
|
|
@ -156,14 +155,6 @@ func (rp *RequestPool) OnIncomingSyncRequest(req *http.Request, device *userapi.
|
|||
}
|
||||
}
|
||||
|
||||
logger := util.GetLogger(req.Context()).WithFields(log.Fields{
|
||||
"user_id": device.UserID,
|
||||
"device_id": device.ID,
|
||||
"since": syncReq.Since,
|
||||
"timeout": syncReq.Timeout,
|
||||
"limit": syncReq.Limit,
|
||||
})
|
||||
|
||||
activeSyncRequests.Inc()
|
||||
defer activeSyncRequests.Dec()
|
||||
|
||||
|
|
@ -197,10 +188,10 @@ func (rp *RequestPool) OnIncomingSyncRequest(req *http.Request, device *userapi.
|
|||
case <-rp.deviceListStream.NotifyAfter(waitctx, syncReq.Since.DeviceListPosition):
|
||||
}
|
||||
|
||||
logger.Println("Responding to sync after wakeup")
|
||||
syncReq.Log.Println("Responding to sync after wakeup")
|
||||
waitcancel()
|
||||
} else {
|
||||
logger.Println("Responding to sync immediately")
|
||||
syncReq.Log.Println("Responding to sync immediately")
|
||||
}
|
||||
|
||||
if syncReq.Since.IsEmpty() {
|
||||
|
|
|
|||
|
|
@ -6,10 +6,12 @@ import (
|
|||
|
||||
userapi "github.com/matrix-org/dendrite/userapi/api"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type SyncRequest struct {
|
||||
Context context.Context
|
||||
Log *logrus.Entry
|
||||
Device *userapi.Device
|
||||
Response *Response
|
||||
Filter gomatrixserverlib.EventFilter
|
||||
|
|
@ -18,8 +20,7 @@ type SyncRequest struct {
|
|||
Timeout time.Duration
|
||||
WantFullState bool
|
||||
|
||||
// Below this line are items updated by the
|
||||
// stream providers. Not thread-safe.
|
||||
// Updated by the PDU stream.
|
||||
Rooms map[string]string
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue