Skip to content

Conversation

@mtojek
Copy link
Contributor

@mtojek mtojek commented Jul 7, 2022

Fixes: #584

@mtojek mtojek self-assigned this Jul 7, 2022
@mtojek mtojek requested a review from a team July 7, 2022 15:58
@elasticmachine
Copy link
Collaborator

elasticmachine commented Jul 7, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-07-07T16:06:11.475+0000

  • Duration: 28 min 0 sec

Test stats 🧪

Test Results
Failed 0
Passed 770
Skipped 0
Total 770

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@elasticmachine
Copy link
Collaborator

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (31/31) 💚
Files 66.379% (77/116) 👍
Classes 61.963% (101/163) 👍
Methods 49.619% (326/657) 👎 -0.152
Lines 33.07% (2925/8845) 👎 -0.094
Conditionals 100.0% (0/0) 💚

Copy link
Contributor

@mrodm mrodm left a comment

Choose a reason for hiding this comment

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

LGTM, just a suggestion regarding shouldDirectoryBeSkipped function

Comment on lines +59 to 65
// shouldDirectoryBeSkipped function checks if absolute path or last element should be skipped.
func shouldDirectoryBeSkipped(path string, skippedDirs []string) bool {
for _, d := range skippedDirs {
if name == d {
if path == d || filepath.Base(path) == d {
return true
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

As a suggestion, skippedDirs parameter could be changed to be of type map[string]bool and just look whether or not the key is present. That would avoid to compare all the elements for every element in the directory when executing CopyWithSkipped.

It's also true that this would just have some benefits in the boot process (BootUp function) according to the current usages of this function, so not sure if it can be kept just an array for now. WDYT ?

Some data, with the tests I've being doing with metrics I saw that there are at least 1584 packages being indexed currently.

func shouldDirectoryBeSkipped(path string, skippedDirs map[string]bool) bool {
    if _, found := skippedDirs[path]; found {
        return true
    }
    if _, found := skippedDirs[filepath.Base(path)]; found {
        return true
    }
    return false
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Keep in mind that the real use case for this is building one package at a time and including it in the stack. Also, the skippedDirs list will contain max. 1-2 entries on average, so I would keep the array here.

Let me know what you think :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah! Ok, I thought that the BootUp function was related to walk through all the packages and versions. If that is intended for just one package with just a few entries, then let's just keep the array of directories 👍

@mtojek mtojek merged commit 6e752ae into elastic:main Jul 8, 2022
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.

Make sure that our tools support the Package Storage v2

3 participants