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

fix: list objects to respect configurable ListObjectsDeadline #704

Merged
merged 4 commits into from Apr 25, 2023

Conversation

adriantam
Copy link
Member

@adriantam adriantam commented Apr 20, 2023

Description

List objects should return results when ListObjectsDeadline is hit rather than waiting for results to be completed. Otherwise, 500 internal error will be returned if the request takes a long time (i.e., maybe due to many items to be looked up).

References

Tests

  • Added unit test
  • Manual test by adding a 10 seconds timeout in the reverseExpandObject. Observe than 500 Internal Error is returned before the change. 200 OK with empty list is returned after the change.

Review Checklist

  • I have clicked on "allow edits by maintainers".
  • I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
  • The correct base branch is being used, if not main
  • I have added tests to validate that the change in functionality is working as expected

@adriantam adriantam requested a review from a team as a code owner April 20, 2023 21:13
@codecov
Copy link

codecov bot commented Apr 21, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.12 🎉

Comparison is base (f3c97f1) 77.99% compared to head (f6a72e6) 78.10%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #704      +/-   ##
==========================================
+ Coverage   77.99%   78.10%   +0.12%     
==========================================
  Files          59       59              
  Lines        7030     7044      +14     
==========================================
+ Hits         5482     5501      +19     
+ Misses       1260     1257       -3     
+ Partials      288      286       -2     
Impacted Files Coverage Δ
pkg/server/commands/list_objects.go 81.58% <100.00%> (+1.21%) ⬆️

... and 5 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@adriantam adriantam requested a review from jon-whit April 21, 2023 13:22
pkg/server/commands/list_objects.go Outdated Show resolved Hide resolved
pkg/server/commands/list_objects.go Outdated Show resolved Hide resolved
pkg/server/test/list_objects.go Outdated Show resolved Hide resolved
pkg/server/test/list_objects.go Outdated Show resolved Hide resolved
pkg/server/test/list_objects.go Outdated Show resolved Hide resolved
pkg/server/test/list_objects.go Outdated Show resolved Hide resolved
pkg/storage/mocks/slow_storage.go Outdated Show resolved Hide resolved
pkg/storage/mocks/slow_storage.go Outdated Show resolved Hide resolved
pkg/server/test/list_objects.go Outdated Show resolved Hide resolved
List objects should return results when ListObjectsDeadline is hit rather
than waiting for results to be completed. Otherwise, 500 internal error
will be returned if the request takes a long time.

Close #703
@adriantam adriantam merged commit 5c60d9d into main Apr 25, 2023
11 checks passed
@adriantam adriantam deleted the fix/listobject_timeout branch April 25, 2023 15:19
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.

Internal server error of context deadline exceeded for list object with but not relationship under load
3 participants