mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 16:35:53 +02:00
[GH-ISSUE #510] Lifespan of a topic. #388
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#388
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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?
@binwiederhier commented on GitHub (Nov 19, 2022):
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).
Topics are deleted from this struct when there are no messages in the cache for it, and no subscribers associated with it.
Until the last message for it is pruned from the cache. So by default 12h.
By deleting the message from the message cache and unsubscribing, you can effectively delete it from the in-memory struct.
@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
@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.
@binwiederhier commented on GitHub (Nov 19, 2022):
Happy to answer more questions. Closing the ticket for ticket hygiene. Hope this answer helped.