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: refactor getDestFromSrc #39

Merged

Conversation

wahapo
Copy link
Contributor

@wahapo wahapo commented Jan 13, 2022

Context

triggerFactory.getDestFromSrc() is called a number of times proportional to the number of jobs defined in the pipeline. (source-code)
Since getDestFromSrc() executes heavy queries to the DB, the number of times it should be reduced as much as possible.

It is called with the same argument in calculateNodes() and calculateEdges(), and the number of times it is called increases tremendously as the number of jobs increases.

Objective

I refactored it to halve the number of calls in calculateNodes() and calculateEdges().

References

License

I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.

@@ -3,27 +3,27 @@
{ "name": "~pr" },
{ "name": "~commit" },
{ "name": "A" },
{ "name": "sd@777:external-level1" },
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The order seems to change a bit.

* @param {Number} pipelineId Id of the current pipeline
* @param {Object} jobs Hash of job configurations
* @param {TriggerFactory} triggerFactory Trigger Factory to find external triggers
* @param {Number} pipelineId Id of the current pipeline
Copy link
Contributor

Choose a reason for hiding this comment

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

[nits] pipelineId was removed.

Copy link
Contributor

@y-oksaku y-oksaku left a comment

Choose a reason for hiding this comment

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

👍

@tkyi tkyi merged commit 52503aa into screwdriver-cd:master Jan 18, 2022
@wahapo wahapo deleted the refactor-getDestFromSrc branch January 19, 2022 00:57
@sd-buildbot
Copy link

🎉 This PR is included in version 3.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

None yet

8 participants