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

Add pagintion to backfills index and service show pages #422

Merged
merged 2 commits into from
Feb 27, 2025

Conversation

adrw
Copy link
Collaborator

@adrw adrw commented Feb 26, 2025

Screenshot 2025-02-26 at 12 31 17 Screenshot 2025-02-26 at 12 31 28 Screenshot 2025-02-26 at 12 32 43 Screenshot 2025-02-26 at 12 32 52

@adrw adrw requested a review from mpawliszyn February 26, 2025 20:33
@QueryParam offset: String? = null,
@QueryParam lastOffset: String? = null,
): Response<ResponseBody> {
val (backfills, nextOffset) = transacter.transaction { session ->
Copy link
Contributor

Choose a reason for hiding this comment

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

nit - readOnly(). Could also use replicaRead since the replication lag should be acceptable for querying live status

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mpawliszyn does Backfila have read replicas in staging/production?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think for now the simplicity is worth more than the performance.

.newPager(
idDescPaginator(),
initialOffset = offset?.let { Offset(it) },
pageSize = 12,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit - put the page size in a companion object const (could also make it user configurable)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Going to punt on this to match the existing style across other callsites, but generally agree with this approach of moving to companion object

}
.list(session)
.newPager(
idDescPaginator(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Didn't you want to order by updated_at?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Turns out the old impl just used the id so I'll stick with that pattern since it matches status quo and is easier.

?.contents
}

val a = "a"
Copy link
Contributor

Choose a reason for hiding this comment

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

Unneeded?

@Inject private lateinit var scope: ActionScope

@Test
fun happyPath() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we inject the BackfillIndexAction and assert the contents of its response for a couple different offset values?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah I'll go ahead and delete this test class, I was just using it to play with the Paginator and have a debugger.

@adrw adrw force-pushed the 2025-02-26.pagination branch from 8791e72 to 37605c3 Compare February 27, 2025 21:48
@adrw adrw force-pushed the 2025-02-26.pagination branch from 37605c3 to e7322f4 Compare February 27, 2025 22:01
@adrw adrw merged commit 1ae6d03 into master Feb 27, 2025
5 checks passed
@adrw adrw mentioned this pull request Feb 27, 2025
11 tasks
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.

4 participants