[GH-ISSUE #510] Lifespan of a topic. #388

Closed
opened 2026-05-07 00:23:44 +02:00 by BreizhHardware · 4 comments

Originally created by @DaveMcElwee on GitHub (Nov 19, 2022).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/510

There is a server setting 'manager-interval' that mentions 'deleting topics'. Can you offer more information about the lifecycle of a topic?
What circumstances prompt a topic to be deleted?
If no one is subscribed to a topic, how long does the topic persist on the server?
Once a topic is created, can it be deleted other than by a server admin?

Originally created by @DaveMcElwee on GitHub (Nov 19, 2022). Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/510 There is a server setting 'manager-interval' that mentions 'deleting topics'. Can you offer more information about the lifecycle of a topic? What circumstances prompt a topic to be deleted? If no one is subscribed to a topic, how long does the topic persist on the server? Once a topic is created, can it be deleted other than by a server admin?
BreizhHardware 2026-05-07 00:23:44 +02:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@binwiederhier commented on GitHub (Nov 19, 2022):

There is a server setting 'manager-interval' that mentions 'deleting topics'. Can you offer more information about the lifecycle of a topic?

Great question.

Topics are "ephemeral", meaning they don't really exist outside of a struct in memory. The struct is only used to keep track of the WS and JSON stream subscribers, i.e. to know where to forward the message to. And it is used to print the stats.

When you restart the ntfy server, the topics struct is repopulated from the message cache with just the names of the topics, but obviously without subscribers (until someone re-connects).

What circumstances prompt a topic to be deleted?

Topics are deleted from this struct when there are no messages in the cache for it, and no subscribers associated with it.

If no one is subscribed to a topic, how long does the topic persist on the server?

Until the last message for it is pruned from the cache. So by default 12h.

Once a topic is created, can it be deleted other than by a server admin?

By deleting the message from the message cache and unsubscribing, you can effectively delete it from the in-memory struct.

<!-- gh-comment-id:1320890221 --> @binwiederhier commented on GitHub (Nov 19, 2022): > There is a server setting 'manager-interval' that mentions 'deleting topics'. Can you offer more information about the lifecycle of a topic? Great question. Topics are "ephemeral", meaning they don't really exist outside of a struct in memory. The struct is only used to keep track of the WS and JSON stream subscribers, i.e. to know where to forward the message to. And it is used to print the stats. When you restart the ntfy server, the topics struct is repopulated from the message cache with just the names of the topics, but obviously without subscribers (until someone re-connects). > What circumstances prompt a topic to be deleted? Topics are deleted from this struct when there are no messages in the cache for it, and no subscribers associated with it. > If no one is subscribed to a topic, how long does the topic persist on the server? Until the last message for it is pruned from the cache. So by default 12h. > Once a topic is created, can it be deleted other than by a server admin? By deleting the message from the message cache and unsubscribing, you can effectively delete it from the in-memory struct.
Author
Owner

@DaveMcElwee commented on GitHub (Nov 19, 2022):

Wow, fast and thorough response. Danke!
A follow-on question:
What happens if a topic has been deleted and a message is posted to it?
What will the server response look like in that scenario?

mit freundlichen Grüßen

<!-- gh-comment-id:1320899216 --> @DaveMcElwee commented on GitHub (Nov 19, 2022): Wow, fast and thorough response. Danke! A follow-on question: What happens if a topic has been deleted and a message is posted to it? What will the server response look like in that scenario? mit freundlichen Grüßen
Author
Owner

@binwiederhier commented on GitHub (Nov 19, 2022):

The server struct for topics is just used internally to manage subscribers listening to a topic. The server response is the same and the behavior is the same, regardless of whether you subscribed to the topic before or if it's brand new. No difference. When it's new we just add a new entry to the struct internally.

<!-- gh-comment-id:1320923179 --> @binwiederhier commented on GitHub (Nov 19, 2022): The server struct for topics is just used internally to manage subscribers listening to a topic. The server response is the same and the behavior is the same, regardless of whether you subscribed to the topic before or if it's brand new. No difference. When it's new we just add a new entry to the struct internally.
Author
Owner

@binwiederhier commented on GitHub (Nov 19, 2022):

Happy to answer more questions. Closing the ticket for ticket hygiene. Hope this answer helped.

<!-- gh-comment-id:1320951677 --> @binwiederhier commented on GitHub (Nov 19, 2022): Happy to answer more questions. Closing the ticket for ticket hygiene. Hope this answer helped.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntfy#388
No description provided.