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

Small cleanup in mercury v0.3 request code #11442

Merged
merged 1 commit into from
Dec 1, 2023

Conversation

infiloop2
Copy link
Contributor

@infiloop2 infiloop2 commented Dec 1, 2023

AUTO-7930

Doing a minor cleanup in mercury v0.3 code post refactor
Since it only does one request, it doesn't need to wait for results in a loop. Aggregation of retryable/success values also becomes easier as no aggregation is required, rather it just depends on a single value now

Test plan:
Rely on exisitng CI tests for mercury 0.3 path and also code review as it's a small change

Copy link
Contributor

github-actions bot commented Dec 1, 2023

I see that you haven't updated any CHANGELOG files. Would it make sense to do so?

c.threadCtrl.Go(func(ctx context.Context) {
c.multiFeedsRequest(ctx, ch, streamsLookup)
})

var reqErr error
var retryInterval time.Duration
results := make([][]byte, len(streamsLookup.Feeds))
retryable := true
allSuccess := true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

no longer need to have logic for allSuccess since we don't have a loop and its based on single result

c.threadCtrl.Go(func(ctx context.Context) {
c.multiFeedsRequest(ctx, ch, streamsLookup)
})

var reqErr error
var retryInterval time.Duration
results := make([][]byte, len(streamsLookup.Feeds))
retryable := true
allSuccess := true
retryable := false
Copy link
Contributor Author

@infiloop2 infiloop2 Dec 1, 2023

Choose a reason for hiding this comment

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

no longer need to start with true and keep doing && within loop

If the single request fails then we'll set the retryable value, else it's false by default

if len(streamsLookup.Feeds) == 0 {
return mercury.NoPipelineError, mercury.MercuryUpkeepFailureReasonInvalidRevertDataInput, [][]byte{}, false, 0 * time.Second, fmt.Errorf("invalid revert data input: feed param key %s, time param key %s, feeds %s", streamsLookup.FeedParamKey, streamsLookup.TimeParamKey, streamsLookup.Feeds)
}
resultLen = 1
resultLen := 1 // Only 1 multi-feed request is made for all feeds
ch := make(chan mercury.MercuryData, resultLen)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

previously a larger size channel was being made than was necessary (only 1 value was written to it). Reducing this shouldn't have any effect

@cl-sonarqube-production
Copy link

SonarQube Quality Gate

Quality Gate failed

Failed condition 66.7% 66.7% Coverage on New Code (is less than 75%)

See analysis details on SonarQube

@infiloop2 infiloop2 marked this pull request as ready for review December 1, 2023 14:45
@infiloop2 infiloop2 requested a review from a team as a code owner December 1, 2023 14:45
@infiloop2 infiloop2 added this pull request to the merge queue Dec 1, 2023
Merged via the queue into develop with commit 7aed097 Dec 1, 2023
85 checks passed
@infiloop2 infiloop2 deleted the auto-cleanup-mercury-v03 branch December 1, 2023 16:45
fbac pushed a commit that referenced this pull request Dec 14, 2023
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