Skip to content

[BUG] Expires_at filter not being used in the pipeline to send messages to the users #401

Closed

Description

@kushagra0902

Describe the bug
The message pipeline only uses the filer "deleted_at" and not expires_at. This will result in messages that are expired now still being sent to users. This is especially more problematic when we later enable gift-wrapped messages(in nip 42 project).

To Reproduce
Steps to reproduce the behavior:

  1. Generate a secret key using openssl rand -hex 128 and set it in your env
  2. use the script ./scripts/start to start a relay server
  3. send a message with an expiry of say 3 sec and after 3 sec try to retrieve it again.

Expected behavior
A no message or an empty message

System (please complete the following information):

  • OS: ubuntu 24.04
  • Platform: docker

Logs

Connected: ws://127.0.0.1:8008
IN: [
  'OK',
  '7b335ac11548ff49e3ddf7c4d6634e7706ac8ce11abafc60e247abf658ee1e12',
  true,
  ''
]
IN: [
  'EVENT',
  'before',
  {
    id: '7b335ac11548ff49e3ddf7c4d6634e7706ac8ce11abafc60e247abf658ee1e12',
    kind: 1,
    pubkey: '6aea200fe3cac06908496e47baebe68f88fa9cb85a1b7a8fa6f0d0abc426a36f',
    created_at: 1775687029,
    content: 'expiry-check-1775687029515',
    tags: [ [Array] ],
    sig: 'f1f4a115b0f40597065a9992880b635efefd4d35fc151eda6d87e0c393bc1ead6ebe4e633dc28ea07fba1a585d14e3a47bf6133b61eebd879982f60030a22185'
  }
]
IN: [ 'EOSE', 'before' ]
IN: [
  'EVENT',
  'after',
  {
    id: '7b335ac11548ff49e3ddf7c4d6634e7706ac8ce11abafc60e247abf658ee1e12',
    kind: 1,
    pubkey: '6aea200fe3cac06908496e47baebe68f88fa9cb85a1b7a8fa6f0d0abc426a36f',
    created_at: 1775687029,
    content: 'expiry-check-1775687029515',
    tags: [ [Array] ],
    sig: 'f1f4a115b0f40597065a9992880b635efefd4d35fc151eda6d87e0c393bc1ead6ebe4e633dc28ea07fba1a585d14e3a47bf6133b61eebd879982f60030a22185'
  }
]
IN: [ 'EOSE', 'after' ]
Result before expiry: FOUND
Result after expiry: FOUND

These are the result logs from a script that connects to the relay, sends a message with an expiry of 3 seconds and then again queries it.

Activity

  1. kushagra0902 commented on Apr 8, 2026

    @kushagra0902
    ContributorAuthor

    I have the solution ready by adding a simple filter in the pipeline that uses existing database column expires_at. I have also made necessary test cases for this case

  2. cameri commented on Apr 8, 2026

    @cameri
    Owner

    Great catch! bravo

  3. linked a pull request that will close this issueAdded expires_at filter in message pipeline #403on Apr 10, 2026
  4. chappie-daemon commented on Apr 10, 2026

    @chappie-daemon
    Collaborator

    Thanks @kushagra0902 for the fix! The expires_at filter has been merged in PR #403.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions