mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-16 03:13:11 -06:00
Fix lint errors
This commit is contained in:
parent
5f791f5e42
commit
481809aaad
|
|
@ -257,7 +257,7 @@ func (r *messagesReq) retrieveEvents() (
|
|||
end.PDUPosition = types.StreamPosition(1)
|
||||
}
|
||||
|
||||
return
|
||||
return clientEvents, start, end, err
|
||||
}
|
||||
|
||||
// handleEmptyEventsSlice handles the case where the initial request to the
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ func (d *SyncServerDatasource) Events(ctx context.Context, eventIDs []string) ([
|
|||
// WriteEvent into the database. It is not safe to call this function from multiple goroutines, as it would create races
|
||||
// when generating the sync stream position for this event. Returns the sync stream position for the inserted event.
|
||||
// Returns an error if there was a problem inserting this event.
|
||||
// nolint: gocyclo
|
||||
func (d *SyncServerDatasource) WriteEvent(
|
||||
ctx context.Context,
|
||||
ev *gomatrixserverlib.Event,
|
||||
|
|
@ -179,7 +180,8 @@ func (d *SyncServerDatasource) WriteEvent(
|
|||
|
||||
return d.updateRoomState(ctx, txn, removeStateEventIDs, addStateEvents, pduPosition)
|
||||
})
|
||||
return
|
||||
|
||||
return pduPosition, returnErr
|
||||
}
|
||||
|
||||
func (d *SyncServerDatasource) updateRoomState(
|
||||
|
|
@ -838,7 +840,7 @@ func (d *SyncServerDatasource) addRoomDeltaToResponse(
|
|||
types.PaginationTokenTypeTopology, backwardTopologyPos, 0,
|
||||
).String()
|
||||
// Use the short form of batch token for prev_batch
|
||||
//jr.Timeline.PrevBatch = strconv.FormatInt(prevPDUPos, 10)
|
||||
jr.Timeline.PrevBatch = strconv.FormatInt(int64(prevPDUPos), 10)
|
||||
jr.Timeline.Events = gomatrixserverlib.ToClientEvents(recentEvents, gomatrixserverlib.FormatSync)
|
||||
jr.Timeline.Limited = false // TODO: if len(events) >= numRecents + 1 and then set limited:true
|
||||
jr.State.Events = gomatrixserverlib.ToClientEvents(delta.stateEvents, gomatrixserverlib.FormatSync)
|
||||
|
|
@ -853,7 +855,7 @@ func (d *SyncServerDatasource) addRoomDeltaToResponse(
|
|||
types.PaginationTokenTypeStream, backwardTopologyPos, 0,
|
||||
).String()
|
||||
// Use the short form of batch token for prev_batch
|
||||
//lr.Timeline.PrevBatch = strconv.FormatInt(prevPDUPos, 10)
|
||||
lr.Timeline.PrevBatch = strconv.FormatInt(int64(prevPDUPos), 10)
|
||||
lr.Timeline.Events = gomatrixserverlib.ToClientEvents(recentEvents, gomatrixserverlib.FormatSync)
|
||||
lr.Timeline.Limited = false // TODO: if len(events) >= numRecents + 1 and then set limited:true
|
||||
lr.State.Events = gomatrixserverlib.ToClientEvents(delta.stateEvents, gomatrixserverlib.FormatSync)
|
||||
|
|
|
|||
|
|
@ -79,23 +79,6 @@ func getTimeout(timeoutMS string) time.Duration {
|
|||
return time.Duration(i) * time.Millisecond
|
||||
}
|
||||
|
||||
// getPaginationToken tries to parse a 'since' token taken from the API to a
|
||||
// pagination token. If the string is empty then (nil, nil) is returned.
|
||||
// Returns an error if the parsed token's type isn't types.PaginationTokenTypeStream.
|
||||
func getSyncStreamPosition(since string) (*types.StreamPosition, error) {
|
||||
if since == "" {
|
||||
return nil, nil
|
||||
}
|
||||
p, err := getPaginationToken(since)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if p.Type != types.PaginationTokenTypeStream {
|
||||
return nil, ErrNotStreamToken
|
||||
}
|
||||
return &(p.PDUPosition), nil
|
||||
}
|
||||
|
||||
// getSyncStreamPosition tries to parse a 'since' token taken from the API to a
|
||||
// types.PaginationToken. If the string is empty then (nil, nil) is returned.
|
||||
// There are two forms of tokens: The full length form containing all PDU and EDU
|
||||
|
|
|
|||
Loading…
Reference in a new issue