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 handler and tasks to use the same struct #104

Open
SoapHia opened this issue Feb 15, 2021 · 0 comments
Open

Refactor handler and tasks to use the same struct #104

SoapHia opened this issue Feb 15, 2021 · 0 comments

Comments

@SoapHia
Copy link
Collaborator

SoapHia commented Feb 15, 2021

In all the funcs inside tasks/tasks.go, the variables tsbridge.MetricConfig, tsbridge.Metrics, tsbridge.Config and storage.Manager are required repeatedly. Instead of passing them every time, a struct could be made to store these values. This would make the function calls much cleaner to read.

There is already a struct named web.Handler which stores these values, so the code should be refactored to use the same struct in both handlers.go and tasks.go. Currently, handlers.go is only used for AppEngine, whereas tasks.go functions are used in both AppEngine and non-AppEngine cases. This must be accounted for when refactoring.

See also: post by @nerdinary in #103 (comment)

@SoapHia SoapHia changed the title Refactor AppEngine and syncLoop tasks to use the same struct Refactor AppEngine and tasks to use the same struct Feb 15, 2021
@SoapHia SoapHia changed the title Refactor AppEngine and tasks to use the same struct Refactor handler and tasks to use the same struct Feb 15, 2021
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

No branches or pull requests

1 participant