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

Pivotal ID # 185255899: Migrate Top AE Studies #721

Merged
merged 3 commits into from
Jun 19, 2023

Conversation

jhoanmanuelms
Copy link
Contributor

https://www.pivotaltracker.com/story/show/185255899

  • Use a page iterator for the submission request files in order to avoid cursor timeouts
  • Remove unused code

- Use a page iterator for the submission request files in order to avoid cursor timeouts
- Remove unused code
@jhoanmanuelms jhoanmanuelms self-assigned this Jun 12, 2023
@jhoanmanuelms jhoanmanuelms requested a review from Juan-EBI June 12, 2023 14:33
Copy link
Contributor

@Juan-EBI Juan-EBI left a comment

Choose a reason for hiding this comment

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

LGTM please consider comment before merge

import org.springframework.data.domain.Page
import org.springframework.data.domain.PageRequest

fun SubmissionRequestFilesRepository.getRequestFilesAsSequence(
Copy link
Contributor

@Juan-EBI Juan-EBI Jun 13, 2023

Choose a reason for hiding this comment

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

maybe (looks simpler for me)

fun SubmissionRequestFilesRepository.getRequestFilesAsSequence(
    accNo: String,
    version: Int,
    startingAt: Int,
): Sequence<DocSubmissionRequestFile> = sequence {
    var startPage = 0
    var files = findRequestFiles(accNo, version, startingAt, PageRequest.of(startPage, CHUNK_SIZE))

    while (files.isEmpty.not()) {
        yieldAll(files)
        files = findRequestFiles(accNo, version, startingAt, PageRequest.of(++startPage, CHUNK_SIZE))
    }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice!! 👏 👏

@jhoanmanuelms jhoanmanuelms merged commit 17389b9 into master Jun 19, 2023
@jhoanmanuelms jhoanmanuelms deleted the chore/pivotal-#185255899-manual-iterator branch June 19, 2023 09:11
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.

2 participants