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: server manager #1956

Merged
merged 4 commits into from
Jun 30, 2021
Merged

refactor: server manager #1956

merged 4 commits into from
Jun 30, 2021

Conversation

bzp2010
Copy link
Contributor

@bzp2010 bzp2010 commented Jun 26, 2021

Please answer these questions before submitting a pull request, or your PR will get closed.

Why submit this pull request?

  • Bugfix
  • New feature provided
  • Improve performance
  • Backport patches

What changes will this PR take into?

Refactoring the management code of Manager API to help to initialize, start and stop. Reduce redundant code and improve readability.

I created a new server module in internal/core.
It will help run according to the process of NewServer()->server.init()->Start()->Stop().
It covers the functions of initializing etcd client, initializing store, initializing route and starting HTTP server.

Checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

@netlify
Copy link

netlify bot commented Jun 26, 2021

✔️ Deploy Preview for apisix-dashboard ready!

🔨 Explore the source changes: eeb8bbc

🔍 Inspect the deploy log: https://app.netlify.com/sites/apisix-dashboard/deploys/60d975c1ff28bc0007fd8b5a

😎 Browse the preview: https://deploy-preview-1956--apisix-dashboard.netlify.app

@codecov-commenter
Copy link

codecov-commenter commented Jun 26, 2021

Codecov Report

Merging #1956 (eeb8bbc) into master (4612d02) will decrease coverage by 3.34%.
The diff coverage is 50.51%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1956      +/-   ##
==========================================
- Coverage   66.89%   63.54%   -3.35%     
==========================================
  Files         179       60     -119     
  Lines        6551     3421    -3130     
  Branches      753        0     -753     
==========================================
- Hits         4382     2174    -2208     
+ Misses       1899      967     -932     
- Partials      270      280      +10     
Flag Coverage Δ
backend-e2e-test 44.72% <50.51%> (+0.09%) ⬆️
backend-e2e-test-ginkgo ?
backend-unit-test 52.26% <0.00%> (-0.06%) ⬇️
frontend-e2e-test ?

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

Impacted Files Coverage Δ
api/cmd/version.go 50.00% <0.00%> (-16.67%) ⬇️
api/internal/core/server/store.go 14.28% <14.28%> (ø)
api/internal/core/server/server.go 49.05% <49.05%> (ø)
api/internal/core/server/http.go 54.54% <54.54%> (ø)
api/cmd/root.go 78.04% <63.63%> (+18.45%) ⬆️
api/internal/utils/version.go 100.00% <100.00%> (ø)
api/internal/core/migrate/conflict.go 0.00% <0.00%> (-76.93%) ⬇️
api/internal/core/migrate/migrate.go 0.00% <0.00%> (-75.00%) ⬇️
api/internal/core/migrate/dataset.go 0.00% <0.00%> (-52.73%) ⬇️
api/internal/handler/migrate/migrate.go 5.55% <0.00%> (-51.86%) ⬇️
... and 140 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4612d02...eeb8bbc. Read the comment docs.

@bzp2010 bzp2010 force-pushed the refactor-server branch 3 times, most recently from e08ad67 to b55762b Compare June 26, 2021 04:17
@bzp2010 bzp2010 marked this pull request as ready for review June 27, 2021 04:41
api/internal/core/server/server.go Outdated Show resolved Hide resolved
api/internal/core/server/server.go Outdated Show resolved Hide resolved
@bzp2010 bzp2010 force-pushed the refactor-server branch 7 times, most recently from dbe9819 to 367d174 Compare June 28, 2021 05:41
@bzp2010 bzp2010 force-pushed the refactor-server branch 5 times, most recently from 557e532 to 29c7210 Compare June 28, 2021 06:56
@bzp2010 bzp2010 requested a review from tokers June 29, 2021 07:25
@bzp2010
Copy link
Contributor Author

bzp2010 commented Jun 30, 2021

Hi, @tokers
If you have free time, can you review it? I have fixed the previous problems.
Thanks!

@tokers tokers merged commit 3cfc327 into apache:master Jun 30, 2021
@bzp2010 bzp2010 deleted the refactor-server branch June 30, 2021 11:42
@bzp2010 bzp2010 restored the refactor-server branch June 30, 2021 11:42
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.

6 participants