-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
DBContext is just a Context #17100
DBContext is just a Context #17100
Conversation
This PR removes some of the specialness from the DBContext and makes it context This allows us to simplify the GetEngine code to wrap around any context in future and means that we can change our loadRepo(e Engine) functions to simply take contexts. Signed-off-by: Andrew Thornton <art27@cantab.net>
unit tests fail |
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Codecov Report
@@ Coverage Diff @@
## main #17100 +/- ##
=======================================
Coverage 45.31% 45.31%
=======================================
Files 773 773
Lines 86873 86907 +34
=======================================
+ Hits 39366 39382 +16
- Misses 41151 41163 +12
- Partials 6356 6362 +6
Continue to review full report at Codecov.
|
stats.Counter.PublicKey, _ = db.GetEngine(db.DefaultContext).Count(new(PublicKey)) | ||
stats.Counter.Repo = CountRepositories(true) | ||
stats.Counter.Watch, _ = db.DefaultContext().Engine().Count(new(Watch)) | ||
stats.Counter.Star, _ = db.DefaultContext().Engine().Count(new(Star)) | ||
stats.Counter.Action, _ = db.DefaultContext().Engine().Count(new(Action)) | ||
stats.Counter.Access, _ = db.DefaultContext().Engine().Count(new(Access)) | ||
stats.Counter.Watch, _ = db.GetEngine(db.DefaultContext).Count(new(Watch)) | ||
stats.Counter.Star, _ = db.GetEngine(db.DefaultContext).Count(new(Star)) | ||
stats.Counter.Action, _ = db.GetEngine(db.DefaultContext).Count(new(Action)) | ||
stats.Counter.Access, _ = db.GetEngine(db.DefaultContext).Count(new(Access)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could introduce a variable to reduce the calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you might imagine, the code was a result of a mass find and replace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but could be changed while working at it.
Please resolve the conflicts. |
Signed-off-by: Andrew Thornton <art27@cantab.net>
make lgtm work |
This PR removes some of the specialness from the DBContext and makes it context
This allows us to simplify the GetEngine code to wrap around any context in future
and means that we can change our loadRepo(e Engine) functions to simply take contexts.
Signed-off-by: Andrew Thornton art27@cantab.net