[PR #842] Make UP return 410 after topic has expired #1440

Open
opened 2026-05-05 04:34:42 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/binwiederhier/ntfy/pull/842
Author: @ShadowJonathan
Created: 8/18/2023
Status: 🔄 Open

Base: mainHead: expire-topic


📝 Commits (1)

  • 91a8115 Make UP return 410 after topic has expired

📊 Changes

2 files changed (+9 additions, -1 deletions)

View changed files

📝 server/errors.go (+1 -0)
📝 server/server.go (+8 -1)

📄 Description

This resolves https://github.com/binwiederhier/ntfy/issues/664;

If a subscription topic;

  • Does not have its t.rateVisitor.Stale()
  • Does not have any subscribers;
  • And the time since last access (including poll and create) has been 16h

...it will start responding with 410s.

This is to make sure that topics eventually will get deleted on servers like mastodon.

There should not be any race condition on first create; Create sets lastAccess to now() the same as a Poll would, through topicsFromIDs, which gets indirectly called from http middleware every time a topic is mentioned, such as here

Unless a client somehow reuses a topic, and sends a topic publish link to the application, which uses it before the client has started its first poll on the topic, this should not create a race condition.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/binwiederhier/ntfy/pull/842 **Author:** [@ShadowJonathan](https://github.com/ShadowJonathan) **Created:** 8/18/2023 **Status:** 🔄 Open **Base:** `main` ← **Head:** `expire-topic` --- ### 📝 Commits (1) - [`91a8115`](https://github.com/binwiederhier/ntfy/commit/91a81159b455c0f837b7a7035c15f4d4da23dfdc) Make UP return 410 after topic has expired ### 📊 Changes **2 files changed** (+9 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `server/errors.go` (+1 -0) 📝 `server/server.go` (+8 -1) </details> ### 📄 Description This resolves https://github.com/binwiederhier/ntfy/issues/664; If a subscription topic; - Does not have its `t.rateVisitor.Stale()` - Does not have any subscribers; - And the time since last access (including poll and create) has been 16h ...it will start responding with 410s. This is to make sure that topics eventually will get deleted on servers like mastodon. There should not be any race condition on first create; Create sets `lastAccess` to `now()` the same as a Poll would, through `topicsFromIDs`, which gets indirectly called from http middleware every time a topic is mentioned, such as [here](https://github.com/ShadowJonathan/ntfy/blob/dd02267f9b3e314ed04948c24da172477af9d26a/server/server_middleware.go#L31) Unless a client somehow reuses a topic, and sends a topic publish link to the application, which uses it *before* the client has started its first poll on the topic, this should not create a race condition. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror added the
pull-request
label 2026-05-05 04:34:42 -06:00
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: github-starred/ntfy#1440
No description provided.