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