mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-06 22:43:10 -06:00
Merge pull request #68 from globekeeper/daniel/secs2ms-multiroom
♻️ Milliseconds instead of seconds for MR.
This commit is contained in:
commit
958ab5606a
2
.github/workflows/dendrite.yml
vendored
2
.github/workflows/dendrite.yml
vendored
|
|
@ -377,7 +377,7 @@ jobs:
|
|||
# See https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md specifically GOROOT_1_17_X64
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install -y libolm3 libolm-dev
|
||||
go get -v github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
|
||||
go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
|
||||
- name: Run actions/checkout@v3 for dendrite
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ func (s *OutputMultiRoomDataConsumer) onMessage(ctx context.Context, msgs []*nat
|
|||
|
||||
rooms, err := s.db.SelectMultiRoomVisibilityRooms(ctx, mrd.SelectMultiRoomVisibilityRoomsParams{
|
||||
UserID: userID,
|
||||
ExpireTs: time.Now().Unix(),
|
||||
ExpireTs: time.Now().UnixMilli(),
|
||||
})
|
||||
if err != nil {
|
||||
sentry.CaptureException(err)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package mrd
|
||||
|
||||
type StateEvent struct {
|
||||
Hidden bool `json:"hidden"`
|
||||
ExpireTs int `json:"expire_ts"`
|
||||
Hidden bool `json:"hidden"`
|
||||
ExpireTs int64 `json:"expire_ts"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ func (s *multiRoomStatements) SelectMultiRoomData(ctx context.Context, r *types.
|
|||
for rows.Next() {
|
||||
r := types.MultiRoomDataRow{}
|
||||
err = rows.Scan(&r.UserId, &r.Type, &r.Data, &t)
|
||||
r.Timestamp = t.Unix()
|
||||
r.Timestamp = t.UnixMilli()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("rows scan: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -655,7 +655,7 @@ func (d *Database) UpdateMultiRoomVisibility(ctx context.Context, event *gomatri
|
|||
UserID: event.Sender(),
|
||||
Type: event.Type(),
|
||||
RoomID: event.RoomID(),
|
||||
ExpireTs: int64(mrdEv.ExpireTs),
|
||||
ExpireTs: mrdEv.ExpireTs,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("insert multiroom visibility failed: %w", err)
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ func AddPublicRoutes(
|
|||
go func() {
|
||||
var affected int64
|
||||
for {
|
||||
affected, err = mrq.DeleteMultiRoomVisibilityByExpireTS(context.Background(), time.Now().Unix())
|
||||
affected, err = mrq.DeleteMultiRoomVisibilityByExpireTS(context.Background(), time.Now().UnixMilli())
|
||||
if err != nil {
|
||||
logrus.WithError(err).Error("failed to expire multiroom visibility")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ func TestMarshallMultiRoom(t *testing.T) {
|
|||
"@3:example.com": map[string]MultiRoomData{
|
||||
"location": {
|
||||
Content: MultiRoomContent(`{"foo":"bar"}`),
|
||||
OriginServerTs: 123,
|
||||
OriginServerTs: 1234567890000,
|
||||
}}})
|
||||
is.NoErr(err)
|
||||
is.Equal(m, []byte(`{"@3:example.com":{"location":{"content":{"foo":"bar"},"origin_server_ts":123}}}`))
|
||||
is.Equal(m, []byte(`{"@3:example.com":{"location":{"content":{"foo":"bar"},"origin_server_ts":1234567890000}}}`))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue