Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FormatException: FormatException: Unexpected character (at character 1) #5554

Closed
sentry-io bot opened this issue Aug 21, 2024 · 6 comments · Fixed by #5573
Closed

FormatException: FormatException: Unexpected character (at character 1) #5554

sentry-io bot opened this issue Aug 21, 2024 · 6 comments · Fixed by #5573
Assignees

Comments

@sentry-io
Copy link

sentry-io bot commented Aug 21, 2024

Sentry Issue: SMOOTHIE-400

FormatException: FormatException: Unexpected character (at character 1)
<!DOCTYPE html><html><head><meta name="robots" content="noindex"></head><bo...
^
@monsieurtanuki
Copy link
Contributor

Looks like TooManyRequestsException, that is solved with openfoodfacts/openfoodfacts-dart#943 and off-dart 3.13.

/// Exception when the server returns "Too many requests".
class TooManyRequestsException implements Exception {
  const TooManyRequestsException();

  /// Start of the response body when the server received too many requests.
  static const String _tooManyRequestsError =
      '<!DOCTYPE html><html><head><meta name="robots" content="noindex"></head><body><h1>TOO MANY REQUESTS</h1>';
// ...

That is, we'll still get the error as we're sending too many requests to the server, but the error will look cleaner. That's a start.

For the record, the limits are:

  • 10 "search products" per minute
  • 100 "get product" per minute

Typical use case where we send many requests: the user page and its counts (products created/edited/...), which use "search products" requests.
That's typically a case where the latest requested value would be good enough: ok we could store it locally, but when/how often should we refresh it? Would there be a less server-intensive way to get those counts?

Generally speaking, an audit about when and how often we run "search products" and "get product" requests would make sense.

@teolemon
Copy link
Member

that's exactly what happened there to a core contributor.

@monsieurtanuki
Copy link
Contributor

On that page there are 4 "search products" counts and 2 "prices" counts.

The current limitations/issues are with the 4 "search products" counts:

  • products I added
  • products I edited
  • products I photographed
  • my to-be-completed products

Assuming that this would solve many of the "search products" limitation issues and that it would be good enough for the moment, this is what I suggest regarding the user counts:

  1. possibly, store the counts in static values - we will compute them only after app restart
  2. possibly, store the counts in local db/preferences - we will compute them only once
  3. add a "refresh" button for hard-core users that really do care about the precise numbers - I don't think they would manually ask for refresh as often as we currently do automatically

@teolemon What do you think of that?

Screenshot_1724251140

@monsieurtanuki
Copy link
Contributor

@teolemon ping

@monsieurtanuki
Copy link
Contributor

@teolemon ping

@teolemon ping

@teolemon
Copy link
Member

teolemon commented Sep 8, 2024

yes, this looks reasonable @monsieurtanuki . We can't fight with the rate limiter, and being blocked means being completely blocked.

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

Successfully merging a pull request may close this issue.

2 participants