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

refactor: simplify the conversion from int to time.Duration as suggested by the golang offical doc. #294

Merged
merged 1 commit into from Feb 15, 2024

Conversation

wzy9607
Copy link
Contributor

@wzy9607 wzy9607 commented Dec 14, 2023

https://pkg.go.dev/time#pkg-constants

To convert an integer number of units to a Duration, multiply:

seconds := 10
fmt.Print(time.Duration(seconds)*time.Second) // prints 10s

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Dec 14, 2023
Copy link
Contributor

mergify bot commented Dec 14, 2023

感谢您提出Pull Request,我会尽快Review。我会在1-2日内进行查看或者回复,如果遇到节假日可能会处理较慢,敬请谅解。

@coveralls
Copy link

Pull Request Test Coverage Report for Build 7210996089

  • 1 of 2 (50.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 74.38%

Changes Missing Coverage Covered Lines Changed/Added Lines %
component/remote/abs.go 0 1 0.0%
Totals Coverage Status
Change from base Build 5706641819: 0.2%
Covered Lines: 1289
Relevant Lines: 1733

💛 - Coveralls

Copy link

stale bot commented Feb 13, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Feb 13, 2024
@wzy9607
Copy link
Contributor Author

wzy9607 commented Feb 13, 2024

1

@stale stale bot removed the stale label Feb 13, 2024
component/remote/abs.go Outdated Show resolved Hide resolved
return nil, err
}
c.Timeout = duration
c.Timeout = time.Duration(appConfigFunc().SyncServerTimeout) * time.Second
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
c.Timeout = time.Duration(appConfigFunc().SyncServerTimeout) * time.Second
c.Timeout = time.Duration(appConfig.SyncServerTimeout) * time.Second

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

component/serverlist/sync.go Outdated Show resolved Hide resolved
@wzy9607 wzy9607 changed the base branch from master to develop February 14, 2024 08:40
…ted by the golang offical doc.

https://pkg.go.dev/time#pkg-constants
Signed-off-by: Cattī Crūdēlēs <17695588+wzy9607@users.noreply.github.com>
Copy link
Member

@nobodyiam nobodyiam left a comment

Choose a reason for hiding this comment

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

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 15, 2024
@mergify mergify bot merged commit 5f9e417 into apolloconfig:develop Feb 15, 2024
5 checks passed
@wzy9607 wzy9607 deleted the update/duration branch February 15, 2024 02:52
zouyx pushed a commit that referenced this pull request Mar 27, 2024
refactor: simplify the conversion from int to time.Duration as suggested by the golang offical doc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants