<commit_before>package notifier

import (
	"log"

	"github.com/turnkey-commerce/go-ping-sites/database"
)

// Notifier sends the notifications to the recipients on a status change.
type Notifier struct {
	Site    database.Site
	Message string
	Subject string
}

// NewNotifier returns a new Notifier object to perform notifications about status change
func NewNotifier(site database.Site, message string, subject string) *Notifier {
	n := Notifier{Site: site, Message: message, Subject: subject}
	return &n
}

// Notify starts the notification for each contact for the site.
func (n *Notifier) Notify() {
	log.Println("Sending Notification of Site Contacts about", n.Subject+"...")
	for _, c := range n.Site.Contacts {
		if c.SmsActive || c.EmailActive {
			// Notify contacts
			log.Println("Sending notifications for", c.Name)
		} else {
			log.Println("No active contact methods for", c.Name)
		}
	}
}<commit_msg>Add function to call in go routine for notifications.<commit_after>package notifier

import (
	"log"
	"sync"

	"github.com/turnkey-commerce/go-ping-sites/database"
)

// Notifier sends the notifications to the recipients on a status change.
type Notifier struct {
	Site    database.Site
	Message string
	Subject string
}

// NewNotifier returns a new Notifier object to perform notifications about status change
func NewNotifier(site database.Site, message string, subject string) *Notifier {
	n := Notifier{Site: site, Message: message, Subject: subject}
	return &n
}

// Notify starts the notification for each contact for the site.
func (n *Notifier) Notify() {
	var wg sync.WaitGroup
	log.Println("Sending Notification of Site Contacts about", n.Subject+"...")
	for _, c := range n.Site.Contacts {
		if c.SmsActive || c.EmailActive {
			// Notify contact
			wg.Add(1)
			go send(c, n.Message, n.Subject, &wg)
		} else {
			log.Println("No active contact methods for", c.Name)
		}
	}
	wg.Wait()
}

func send(c database.Contact, message string, subject string, wg *sync.WaitGroup) {
	log.Println("Sending notifications for", c.Name, subject, message)
	wg.Done()
}
{'fraction_non_alphanumeric': 0.10812109562710236, 'fraction_numerical': 0.0004805382027871216, 'mean_word_length': 4.028985507246377, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5284397', 'n_tokens_mistral': 681, 'n_tokens_neox': 640, 'n_words': 221}