Skip to content

Remove auth restriction on RSS, add rate limiting (1 per 10 seconds.)#1797

Open
MikeNeilson wants to merge 4 commits into
developfrom
task/remove-rss-auth-restriction
Open

Remove auth restriction on RSS, add rate limiting (1 per 10 seconds.)#1797
MikeNeilson wants to merge 4 commits into
developfrom
task/remove-rss-auth-restriction

Conversation

@MikeNeilson

@MikeNeilson MikeNeilson commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Remove auth restriction from RSS feed, but add rate limiting to the expected usage (e.g. 1 request per client every ten seconds)

Related Issue

N/A

Validation

Manually, queried a bunch until it gave me the 429.

existing integration test triggered the 429 and was modified to use the provided Retry-After value.

Checklist

  • AI tools used

@MikeNeilson MikeNeilson force-pushed the task/remove-rss-auth-restriction branch from 980c4d4 to 011321f Compare June 23, 2026 16:51

@krowvin krowvin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure on a few things, wanted to clarify first

Comment thread cwms-data-api/src/main/java/cwms/cda/api/rss/RssHandler.java Outdated
Comment thread cwms-data-api/src/main/java/cwms/cda/api/rss/RssHandler.java Outdated
Comment thread cwms-data-api/src/test/java/cwms/cda/api/rss/RssHandlerIT.java
MessageDao dao = new MessageDao(dsl);
RssFeed feed = dao.retrieveFeed(cursor, pageSize, office, name, since, newLinkTemplate(ctx));
String result = Formats.format(contentType, feed);
ctx.header("Retry-After", "10");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we would want Retry-After to be set if the rate limit is hit instead of just on success. We could also set the cache header to something similar to avoid burst.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I just couldn't think of a clean way... other than move that exception handling into here. which, actually fairly clean reasonable exception, will go do that.

adamkorynta
adamkorynta previously approved these changes Jun 23, 2026
// and we don't want to deal with trying to distinguish in ApiServlet. For the time being this logic will
// remain here.
if (ex.getStatus() == 429) {
var cdaError = new CdaError("Too many requests. Limit queue requests to no more than every 10 seconds.");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably go in the OpenAPI description

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... duh.

krowvin
krowvin previously approved these changes Jun 23, 2026
@MikeNeilson MikeNeilson dismissed stale reviews from krowvin and adamkorynta via 54f97d3 June 24, 2026 14:34
@MikeNeilson MikeNeilson force-pushed the task/remove-rss-auth-restriction branch from 54f97d3 to 96187f7 Compare June 24, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants