Skip to content

Commit ff5c28c

Browse files
committed
maintner: use p.c instead of p.gr.github.c in githubRepoPoller.syncIssues
The githubRepoPoller type has a field c, which is a shortcut for gr.github.c. Other githubRepoPoller methods use it, so start using it in syncIssues as well. This makes the code more consistent and easier to read. Also remove a spurious period in GitHubRepo.newMutationFromIssue documentation. Change-Id: Iecebd2ba6c69e3479e8d627fea691fcf9415aa51 Reviewed-on: https://go-review.googlesource.com/c/160841 Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 0985405 commit ff5c28c

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

maintner/github.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,7 @@ func (d githubIssueDiffer) diffLockedState(m *maintpb.GithubIssueMutation) bool
11931193
// the corpus) and b (the current GitHub API state).
11941194
//
11951195
// If newMutationFromIssue returns nil, the provided github.Issue is no newer
1196-
// than the data we have in the corpus. 'a'. may be nil.
1196+
// than the data we have in the corpus. 'a' may be nil.
11971197
func (r *GitHubRepo) newMutationFromIssue(a *GitHubIssue, b *github.Issue) *maintpb.Mutation {
11981198
if b == nil || b.Number == nil {
11991199
panic(fmt.Sprintf("github issue with nil number: %#v", b))
@@ -1715,7 +1715,6 @@ func (p *githubRepoPoller) foreachItem(
17151715
}
17161716

17171717
func (p *githubRepoPoller) syncIssues(ctx context.Context, expectChanges bool) error {
1718-
c := p.gr.github.c
17191718
page := 1
17201719
seen := make(map[int64]bool)
17211720
keepGoing := true
@@ -1767,12 +1766,12 @@ func (p *githubRepoPoller) syncIssues(ctx context.Context, expectChanges bool) e
17671766
seen[id] = true
17681767

17691768
var mp *maintpb.Mutation
1770-
c.mu.RLock()
1769+
p.c.mu.RLock()
17711770
{
17721771
gi := p.gr.issues[int32(*is.Number)]
17731772
mp = p.gr.newMutationFromIssue(gi, is)
17741773
}
1775-
c.mu.RUnlock()
1774+
p.c.mu.RUnlock()
17761775

17771776
if mp == nil {
17781777
continue
@@ -1794,7 +1793,7 @@ func (p *githubRepoPoller) syncIssues(ctx context.Context, expectChanges bool) e
17941793

17951794
changes++
17961795
p.logf("changed issue %d: %s", is.GetNumber(), is.GetTitle())
1797-
c.addMutation(mp)
1796+
p.c.addMutation(mp)
17981797
p.lastUpdate = time.Now()
17991798
}
18001799

@@ -1812,9 +1811,9 @@ func (p *githubRepoPoller) syncIssues(ctx context.Context, expectChanges bool) e
18121811
}
18131812
}
18141813

1815-
c.mu.RLock()
1814+
p.c.mu.RLock()
18161815
num := len(p.gr.issues)
1817-
c.mu.RUnlock()
1816+
p.c.mu.RUnlock()
18181817
p.logf("After page %d: %v issues, %v changes, %v issues in memory", page, len(issues), changes, num)
18191818

18201819
page++
@@ -1835,7 +1834,7 @@ func (p *githubRepoPoller) syncIssues(ctx context.Context, expectChanges bool) e
18351834
NotExist: true,
18361835
},
18371836
}
1838-
c.addMutation(mp)
1837+
p.c.addMutation(mp)
18391838
continue
18401839
} else if err != nil {
18411840
return err
@@ -1845,7 +1844,7 @@ func (p *githubRepoPoller) syncIssues(ctx context.Context, expectChanges bool) e
18451844
continue
18461845
}
18471846
p.logf("modified issue %d: %s", issue.GetNumber(), issue.GetTitle())
1848-
c.addMutation(mp)
1847+
p.c.addMutation(mp)
18491848
p.lastUpdate = time.Now()
18501849
}
18511850
}

0 commit comments

Comments
 (0)