diff options
Diffstat (limited to 'models/fixture_generation.go')
-rw-r--r-- | models/fixture_generation.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/models/fixture_generation.go b/models/fixture_generation.go index d342919895..6234caefad 100644 --- a/models/fixture_generation.go +++ b/models/fixture_generation.go @@ -4,6 +4,7 @@ package models import ( + "context" "fmt" "strings" @@ -14,15 +15,15 @@ import ( // GetYamlFixturesAccess returns a string containing the contents // for the access table, as recalculated using repo.RecalculateAccesses() -func GetYamlFixturesAccess() (string, error) { +func GetYamlFixturesAccess(ctx context.Context) (string, error) { repos := make([]*repo_model.Repository, 0, 50) - if err := db.GetEngine(db.DefaultContext).Find(&repos); err != nil { + if err := db.GetEngine(ctx).Find(&repos); err != nil { return "", err } for _, repo := range repos { - repo.MustOwner(db.DefaultContext) - if err := access_model.RecalculateAccesses(db.DefaultContext, repo); err != nil { + repo.MustOwner(ctx) + if err := access_model.RecalculateAccesses(ctx, repo); err != nil { return "", err } } @@ -30,7 +31,7 @@ func GetYamlFixturesAccess() (string, error) { var b strings.Builder accesses := make([]*access_model.Access, 0, 200) - if err := db.GetEngine(db.DefaultContext).OrderBy("user_id, repo_id").Find(&accesses); err != nil { + if err := db.GetEngine(ctx).OrderBy("user_id, repo_id").Find(&accesses); err != nil { return "", err } |