From e09019f68ca8c2a426e4997f5f73be2371789a6f Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Thu, 3 Mar 2022 15:33:19 +0000 Subject: [PATCH] Fix the milliseconds --- userapi/storage/postgres/notifications_table.go | 4 ++-- userapi/storage/sqlite3/notifications_table.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/userapi/storage/postgres/notifications_table.go b/userapi/storage/postgres/notifications_table.go index 459bcc59d..a27c1125e 100644 --- a/userapi/storage/postgres/notifications_table.go +++ b/userapi/storage/postgres/notifications_table.go @@ -103,8 +103,8 @@ func NewPostgresNotificationTable(db *sql.DB) (tables.NotificationTable, error) func (s *notificationsStatements) Clean(ctx context.Context, txn *sql.Tx) error { _, err := sqlutil.TxStmt(txn, s.cleanNotificationsStmt).ExecContext( ctx, - time.Now().AddDate(0, 0, -1).UnixMilli(), // keep non-highlights for a day - time.Now().AddDate(0, -1, 0).UnixMilli(), // keep highlights for a month + time.Now().AddDate(0, 0, -1).UnixNano()/int64(time.Millisecond), // keep non-highlights for a day + time.Now().AddDate(0, -1, 0).UnixNano()/int64(time.Millisecond), // keep highlights for a month ) return err } diff --git a/userapi/storage/sqlite3/notifications_table.go b/userapi/storage/sqlite3/notifications_table.go index bf3fd2329..df8260251 100644 --- a/userapi/storage/sqlite3/notifications_table.go +++ b/userapi/storage/sqlite3/notifications_table.go @@ -103,8 +103,8 @@ func NewSQLiteNotificationTable(db *sql.DB) (tables.NotificationTable, error) { func (s *notificationsStatements) Clean(ctx context.Context, txn *sql.Tx) error { _, err := sqlutil.TxStmt(txn, s.cleanNotificationsStmt).ExecContext( ctx, - time.Now().AddDate(0, 0, -1).UnixMilli(), // keep non-highlights for a day - time.Now().AddDate(0, -1, 0).UnixMilli(), // keep highlights for a month + time.Now().AddDate(0, 0, -1).UnixNano()/int64(time.Millisecond), // keep non-highlights for a day + time.Now().AddDate(0, -1, 0).UnixNano()/int64(time.Millisecond), // keep highlights for a month ) return err }