Skip to content
Snippets Groups Projects
Commit 0836590f authored by rromanov's avatar rromanov
Browse files

fix linter

parent 094b4f6d
Branches release/v0.38
Tags b0.38.2
No related merge requests found
......@@ -10,6 +10,7 @@ import (
"github.com/jasonlvhit/gocron"
)
// NotificationPeriod is a period of time after which a user is considered unresponding.
func (root *root) processNotifications(ctx context.Context) {
for ctx.Err() == nil {
root.DeliverNotifications(ctx)
......@@ -18,6 +19,7 @@ func (root *root) processNotifications(ctx context.Context) {
}
}
// DeliverNotifications delivers notifications.
func (root *root) DeliverNotifications(ctx context.Context) (errs []error) {
resp, err := root.Repository.UserListUnresponding(ctx, root.NotificationPeriod)
if err != nil {
......@@ -48,6 +50,7 @@ func (root *root) DeliverNotifications(ctx context.Context) (errs []error) {
return
}
// CreateSendNotificationRequestForUserAboutNewUnreadMessages creates a notification request for a user about new unread messages.
func CreateSendNotificationRequestForUserAboutNewUnreadMessages(userID string) *notification.SendNotificationRequest {
return &notification.SendNotificationRequest{
Entity: notification.Entity_ENTITY_MESSAGE,
......@@ -61,6 +64,7 @@ func CreateSendNotificationRequestForUserAboutNewUnreadMessages(userID string) *
}
}
// processNotificationsByCron sends notifications by cron.
func (root *root) processNotificationsByCron(ctx context.Context) {
err := gocron.Every(1).Day().At("09:00").Do(root.EveryDayNotificationsAboutNewMessages, ctx)
if err != nil {
......@@ -71,6 +75,7 @@ func (root *root) processNotificationsByCron(ctx context.Context) {
<-gocron.Start()
}
// EveryDayNotificationsAboutNewMessages sends notifications about new messages.
func (root *root) EveryDayNotificationsAboutNewMessages(ctx context.Context) (errs []error) {
resp, err := root.Repository.UserListUnResponding(ctx, root.NotificationPeriod)
if err != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment