diff options
Diffstat (limited to 'cache/bug_cache.go')
-rw-r--r-- | cache/bug_cache.go | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/cache/bug_cache.go b/cache/bug_cache.go index 59c39f5c..f0fc7ff6 100644 --- a/cache/bug_cache.go +++ b/cache/bug_cache.go @@ -9,7 +9,6 @@ import ( type BugCacher interface { Snapshot() *bug.Snapshot - ClearSnapshot() // Mutations AddComment(message string) error @@ -25,27 +24,18 @@ type BugCacher interface { type BugCache struct { repo repository.Repo - bug *bug.Bug - snap *bug.Snapshot + bug *bug.WithSnapshot } func NewBugCache(repo repository.Repo, b *bug.Bug) BugCacher { return &BugCache{ repo: repo, - bug: b, + bug: &bug.WithSnapshot{Bug: b}, } } func (c *BugCache) Snapshot() *bug.Snapshot { - if c.snap == nil { - snap := c.bug.Compile() - c.snap = &snap - } - return c.snap -} - -func (c *BugCache) ClearSnapshot() { - c.snap = nil + return c.bug.Snapshot() } func (c *BugCache) AddComment(message string) error { @@ -60,9 +50,6 @@ func (c *BugCache) AddCommentWithFiles(message string, files []util.Hash) error operations.CommentWithFiles(c.bug, author, message, files) - // TODO: perf --> the snapshot could simply be updated with the new op - c.ClearSnapshot() - return nil } @@ -77,9 +64,6 @@ func (c *BugCache) ChangeLabels(added []string, removed []string) error { return err } - // TODO: perf --> the snapshot could simply be updated with the new op - c.ClearSnapshot() - return nil } @@ -91,9 +75,6 @@ func (c *BugCache) Open() error { operations.Open(c.bug, author) - // TODO: perf --> the snapshot could simply be updated with the new op - c.ClearSnapshot() - return nil } @@ -105,9 +86,6 @@ func (c *BugCache) Close() error { operations.Close(c.bug, author) - // TODO: perf --> the snapshot could simply be updated with the new op - c.ClearSnapshot() - return nil } @@ -119,9 +97,6 @@ func (c *BugCache) SetTitle(title string) error { operations.SetTitle(c.bug, author, title) - // TODO: perf --> the snapshot could simply be updated with the new op - c.ClearSnapshot() - return nil } |