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
|
return to
|
||||||
}
|
}
|
||||||
req.Response.Rooms.Join[roomID] = *jr
|
req.Response.Rooms.Join[roomID] = *jr
|
||||||
|
req.Rooms[roomID] = gomatrixserverlib.Join
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add peeked rooms.
|
// Add peeked rooms.
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,10 @@ func (p *TypingStreamProvider) CompleteSync(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
req *types.SyncRequest,
|
req *types.SyncRequest,
|
||||||
) types.StreamPosition {
|
) 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(
|
func (p *TypingStreamProvider) IncrementalSync(
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import (
|
||||||
userapi "github.com/matrix-org/dendrite/userapi/api"
|
userapi "github.com/matrix-org/dendrite/userapi/api"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
"github.com/matrix-org/util"
|
"github.com/matrix-org/util"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
const defaultSyncTimeout = time.Duration(0)
|
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
|
// 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{
|
return &types.SyncRequest{
|
||||||
Context: req.Context(), //
|
Context: req.Context(), //
|
||||||
|
Log: logger, //
|
||||||
Device: &device, //
|
Device: &device, //
|
||||||
Response: types.NewResponse(), // Populated by all streams
|
Response: types.NewResponse(), // Populated by all streams
|
||||||
Filter: gomatrixserverlib.DefaultEventFilter(), //
|
Filter: gomatrixserverlib.DefaultEventFilter(), //
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ import (
|
||||||
userapi "github.com/matrix-org/dendrite/userapi/api"
|
userapi "github.com/matrix-org/dendrite/userapi/api"
|
||||||
"github.com/matrix-org/util"
|
"github.com/matrix-org/util"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// RequestPool manages HTTP long-poll connections for /sync
|
// 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()
|
activeSyncRequests.Inc()
|
||||||
defer activeSyncRequests.Dec()
|
defer activeSyncRequests.Dec()
|
||||||
|
|
||||||
|
|
@ -197,10 +188,10 @@ func (rp *RequestPool) OnIncomingSyncRequest(req *http.Request, device *userapi.
|
||||||
case <-rp.deviceListStream.NotifyAfter(waitctx, syncReq.Since.DeviceListPosition):
|
case <-rp.deviceListStream.NotifyAfter(waitctx, syncReq.Since.DeviceListPosition):
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Println("Responding to sync after wakeup")
|
syncReq.Log.Println("Responding to sync after wakeup")
|
||||||
waitcancel()
|
waitcancel()
|
||||||
} else {
|
} else {
|
||||||
logger.Println("Responding to sync immediately")
|
syncReq.Log.Println("Responding to sync immediately")
|
||||||
}
|
}
|
||||||
|
|
||||||
if syncReq.Since.IsEmpty() {
|
if syncReq.Since.IsEmpty() {
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,12 @@ import (
|
||||||
|
|
||||||
userapi "github.com/matrix-org/dendrite/userapi/api"
|
userapi "github.com/matrix-org/dendrite/userapi/api"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SyncRequest struct {
|
type SyncRequest struct {
|
||||||
Context context.Context
|
Context context.Context
|
||||||
|
Log *logrus.Entry
|
||||||
Device *userapi.Device
|
Device *userapi.Device
|
||||||
Response *Response
|
Response *Response
|
||||||
Filter gomatrixserverlib.EventFilter
|
Filter gomatrixserverlib.EventFilter
|
||||||
|
|
@ -18,8 +20,7 @@ type SyncRequest struct {
|
||||||
Timeout time.Duration
|
Timeout time.Duration
|
||||||
WantFullState bool
|
WantFullState bool
|
||||||
|
|
||||||
// Below this line are items updated by the
|
// Updated by the PDU stream.
|
||||||
// stream providers. Not thread-safe.
|
|
||||||
Rooms map[string]string
|
Rooms map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue