@ -39,9 +39,10 @@ func (box Box) GetNotifier() (AbstractNotifier, error) {
return notifier . New ( box . NotifyConf . Notifications . Options )
}
func ( results BoxCheckResults ) SendNotifications ( notifyTypes [ ] string ) error {
// TODO: expose flag to not use cache
func ( results BoxCheckResults ) SendNotifications ( notifyTypes [ ] string , useCache bool ) error {
if useCache {
results = results . filterChangedFromCache ( )
}
toCheck := results . Size ( notifyTypes )
if toCheck == 0 {
@ -90,12 +91,14 @@ func (results BoxCheckResults) SendNotifications(notifyTypes []string) error {
}
// update cache (with /all/ changed results to reset status)
if useCache {
notifyLog . Debug ( "updating cache" )
cacheError := updateCache ( box , resultsBox )
if cacheError != nil {
notifyLog . Error ( "could not cache notification results: " , cacheError )
errs = append ( errs , cacheError . Error ( ) )
}
}
if len ( resultsDue ) != 0 {
notifyLog . Infof ( "Sent notification for %s via %s with %v updated issues" , box . Name , transport , len ( resultsDue ) )