~ci-train-bot/account-polld/account-polld-ubuntu-yakkety-landing-055

« back to all changes in this revision

Viewing changes to cmd/account-polld/account_manager.go

  • Committer: Bileto Bot
  • Author(s): Arthur Mello
  • Date: 2016-07-06 14:39:11 UTC
  • mfrom: (166.1.2 account-polld-notifications)
  • Revision ID: ci-train-bot@canonical.com-20160706143911-xlr0ej18yn0pjwab
Still run the plugins even when notifications are disabled

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
        "launchpad.net/account-polld/accounts"
25
25
        "launchpad.net/account-polld/plugins"
26
26
        "launchpad.net/ubuntu-push/click"
27
 
        "launchpad.net/ubuntu-push/click/cblacklist"
28
27
)
29
28
 
30
29
type AccountManager struct {
52
51
        clickNotInstalledError = errors.New("Click not installed")
53
52
)
54
53
 
55
 
var isBlacklisted = cblacklist.IsBlacklisted
56
 
 
57
54
func NewAccountManager(watcher *accounts.Watcher, postWatch chan *PostWatch, plugin plugins.Plugin) *AccountManager {
58
55
        return &AccountManager{
59
56
                watcher:   watcher,
80
77
                }
81
78
        }
82
79
 
83
 
        if id, ok := click.ParseAppId(string(a.plugin.ApplicationId())); (ok == nil) && isBlacklisted(id) {
84
 
                log.Printf("Account %d is blacklisted, not polling", a.authData.AccountId)
85
 
                return
86
 
        }
87
 
 
88
80
        if a.penaltyCount > 0 {
89
81
                log.Printf("Leaving poll for account %d as penalty count is %d", a.authData.AccountId, a.penaltyCount)
90
82
                a.penaltyCount--