~ubuntu-push-hackers/ubuntu-push/automatic

« back to all changes in this revision

Viewing changes to messaging/messaging.go

  • Committer: Tarmac
  • Author(s): Samuele Pedroni (Canonical Services Ltd.), Niklas Wenzel
  • Date: 2015-05-20 07:57:36 UTC
  • mfrom: (402.1.3 fix-1451510)
  • Revision ID: tarmac-20150520075736-l3wr3rrb2ewnlzjo
[r=pedronis] skip over Gone messaging notifications to address lp:1451510, eagerly identify them in Tags, tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
func (mmu *MessagingMenu) cleanUpNotifications() {
82
82
        mmu.lock.Lock()
83
83
        defer mmu.lock.Unlock()
 
84
        mmu.doCleanUpNotifications()
 
85
}
 
86
 
 
87
func (mmu *MessagingMenu) doCleanUpNotifications() {
84
88
        for nid, payload := range mmu.notifications {
85
89
                if payload.Gone {
86
90
                        // sweep
122
126
func (mmu *MessagingMenu) Tags(app *click.AppId) []string {
123
127
        orig := app.Original()
124
128
        tags := []string(nil)
125
 
        mmu.lock.RLock()
126
 
        defer mmu.lock.RUnlock()
 
129
        mmu.lock.Lock()
 
130
        defer mmu.lock.Unlock()
 
131
        mmu.doCleanUpNotifications()
127
132
        for _, payload := range mmu.notifications {
128
 
                if payload.App.Original() == orig {
 
133
                if payload.App.Original() == orig && !payload.Gone {
129
134
                        tags = append(tags, payload.Tag)
130
135
                }
131
136
        }