@ -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,11 +91,13 @@ 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)
notifyLog . Debug ( "updating cache" )
if useCache {
cacheError := updateCache ( box , resultsBox )
notifyLog . Debug ( "updating cache" )
if cacheError != nil {
cacheError := updateCache ( box , resultsBox )
notifyLog . Error ( "could not cache notification results: " , cacheError )
if cacheError != nil {
errs = append ( errs , cacheError . Error ( ) )
notifyLog . Error ( "could not cache notification results: " , cacheError )
errs = append ( errs , cacheError . Error ( ) )
}
}
}
if len ( resultsDue ) != 0 {
if len ( resultsDue ) != 0 {