Fix the milliseconds

This commit is contained in:
Neil Alexander 2022-03-03 15:33:19 +00:00
parent db24245be1
commit e09019f68c
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 4 additions and 4 deletions

View file

@ -103,8 +103,8 @@ func NewPostgresNotificationTable(db *sql.DB) (tables.NotificationTable, error)
func (s *notificationsStatements) Clean(ctx context.Context, txn *sql.Tx) error { func (s *notificationsStatements) Clean(ctx context.Context, txn *sql.Tx) error {
_, err := sqlutil.TxStmt(txn, s.cleanNotificationsStmt).ExecContext( _, err := sqlutil.TxStmt(txn, s.cleanNotificationsStmt).ExecContext(
ctx, ctx,
time.Now().AddDate(0, 0, -1).UnixMilli(), // keep non-highlights for a day time.Now().AddDate(0, 0, -1).UnixNano()/int64(time.Millisecond), // keep non-highlights for a day
time.Now().AddDate(0, -1, 0).UnixMilli(), // keep highlights for a month time.Now().AddDate(0, -1, 0).UnixNano()/int64(time.Millisecond), // keep highlights for a month
) )
return err return err
} }

View file

@ -103,8 +103,8 @@ func NewSQLiteNotificationTable(db *sql.DB) (tables.NotificationTable, error) {
func (s *notificationsStatements) Clean(ctx context.Context, txn *sql.Tx) error { func (s *notificationsStatements) Clean(ctx context.Context, txn *sql.Tx) error {
_, err := sqlutil.TxStmt(txn, s.cleanNotificationsStmt).ExecContext( _, err := sqlutil.TxStmt(txn, s.cleanNotificationsStmt).ExecContext(
ctx, ctx,
time.Now().AddDate(0, 0, -1).UnixMilli(), // keep non-highlights for a day time.Now().AddDate(0, 0, -1).UnixNano()/int64(time.Millisecond), // keep non-highlights for a day
time.Now().AddDate(0, -1, 0).UnixMilli(), // keep highlights for a month time.Now().AddDate(0, -1, 0).UnixNano()/int64(time.Millisecond), // keep highlights for a month
) )
return err return err
} }