Refactor handler and tasks to use the same struct
- Dominant language
- Go
- Stars
- 56
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
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 https://github.com/google/ts-bridge/pull/103#discussion_r574277279_
Contributor guide
Assessment
This issue has not been assessed yet.