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

chore: simplify comparison and variable declaration #1209

Merged
merged 1 commit into from
Mar 9, 2023

Conversation

hezhizhen
Copy link
Contributor

Ⅰ. Describe what this PR does

Simplify some code, mainly comparison and variable declaration.

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how to verify it

lint and test

Ⅳ. Special notes for reviews

Signed-off-by: Zhizhen He <hezhizhen.yi@gmail.com>
@codecov-commenter
Copy link

codecov-commenter commented Mar 8, 2023

Codecov Report

Merging #1209 (7451e41) into master (6115b9c) will decrease coverage by 0.03%.
The diff coverage is 53.84%.

❗ Current head 7451e41 differs from pull request most recent head 764a347. Consider uploading reports for the commit 764a347 to get more accurate results

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##           master    #1209      +/-   ##
==========================================
- Coverage   50.04%   50.02%   -0.03%     
==========================================
  Files         143      143              
  Lines       19906    19892      -14     
==========================================
- Hits         9962     9950      -12     
+ Misses       8849     8847       -2     
  Partials     1095     1095              
Flag Coverage Δ
unittests 50.02% <53.84%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/controller/broadcastjob/broadcastjob_utils.go 50.98% <0.00%> (ø)
...availablebudget/podunavailablebudget_controller.go 46.60% <0.00%> (+1.12%) ⬆️
...controller/broadcastjob/broadcastjob_controller.go 54.81% <28.57%> (-0.06%) ⬇️
.../controller/cloneset/cloneset_predownload_image.go 62.16% <66.66%> (ø)
pkg/control/sidecarcontrol/sidecarset_control.go 39.87% <100.00%> (-0.37%) ⬇️
...sistentpodstate/persistent_pod_state_controller.go 31.18% <100.00%> (ø)
pkg/controller/sidecarset/sidecarset_hotupgrade.go 67.05% <100.00%> (ø)
...roller/workloadspread/workloadspread_controller.go 63.52% <100.00%> (ø)
...ting/resourcedistribution_create_update_handler.go 63.09% <100.00%> (ø)
pkg/controller/cloneset/cloneset_controller.go 53.48% <0.00%> (-1.87%) ⬇️
... and 2 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -178,7 +175,8 @@ func (r *ReconcileBroadcastJob) Reconcile(_ context.Context, request reconcile.R
addLabelToPodTemplate(job)

if IsJobFinished(job) {
if isPast, leftTime := pastTTLDeadline(job); isPast {
isPast, leftTime := pastTTLDeadline(job)
Copy link
Member

Choose a reason for hiding this comment

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

Why you need to change here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to write something like

if !isPast && leftTime>0 { return xxx }

klog.Infof(xxx)
...
return xxx

But I was not sure of its correctness, so I reverted it, but this modification was kept.

@zmberg
Copy link
Member

zmberg commented Mar 9, 2023

/lgtm

@zmberg
Copy link
Member

zmberg commented Mar 9, 2023

/approve

@kruise-bot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: zmberg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kruise-bot kruise-bot merged commit fc4aac7 into openkruise:master Mar 9, 2023
ppbits pushed a commit to ppbits/kruise that referenced this pull request Apr 4, 2024
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.

4 participants