diff options
author | Michael Muré <batolettre@gmail.com> | 2022-08-18 16:03:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-18 16:03:48 +0200 |
commit | 6664a251f1893e6ddc183aa6061d6f0fd4f40a57 (patch) | |
tree | e42bcfc39ccf9284f645dde7ae5990c6d4995ade /entity/dag/clock.go | |
parent | ec24de3f0d19ff1a56d0b12d389ec1535be43ea2 (diff) | |
parent | 45f5f852b71a63c142bca8b05efe53eebf142594 (diff) | |
download | git-bug-6664a251f1893e6ddc183aa6061d6f0fd4f40a57.tar.gz |
Merge pull request #844 from MichaelMure/resolvers
WIP resolvers
Diffstat (limited to 'entity/dag/clock.go')
-rw-r--r-- | entity/dag/clock.go | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/entity/dag/clock.go b/entity/dag/clock.go index 793fa1bf..74a6cd73 100644 --- a/entity/dag/clock.go +++ b/entity/dag/clock.go @@ -3,7 +3,8 @@ package dag import ( "fmt" - "github.com/MichaelMure/git-bug/identity" + "golang.org/x/sync/errgroup" + "github.com/MichaelMure/git-bug/repository" ) @@ -18,21 +19,13 @@ func ClockLoader(defs ...Definition) repository.ClockLoader { return repository.ClockLoader{ Clocks: clocks, Witnesser: func(repo repository.ClockedRepo) error { - // we need to actually load the identities because of the commit signature check when reading, - // which require the full identities with crypto keys - resolver := identity.NewCachedResolver(identity.NewSimpleResolver(repo)) - + var errG errgroup.Group for _, def := range defs { - // we actually just need to read all entities, - // as that will create and update the clocks - // TODO: concurrent loading to be faster? - for b := range ReadAll(def, repo, resolver) { - if b.Err != nil { - return b.Err - } - } + errG.Go(func() error { + return ReadAllClocksNoCheck(def, repo) + }) } - return nil + return errG.Wait() }, } } |