@@ -574,12 +574,12 @@ func (service *MessageService) HandleMessageExpired(ctx context.Context, params
574574
575575// MessageScheduleExpirationParams are parameters for scheduling the expiration of a message event
576576type MessageScheduleExpirationParams struct {
577- MessageID uuid.UUID
578- UserID entities.UserID
579- NotificationSentAt time.Time
580- PhoneID uuid.UUID
581- MessageExpirationTimeout time.Duration
582- Source string
577+ MessageID uuid.UUID
578+ UserID entities.UserID
579+ NotificationSentAt time.Time
580+ PhoneID uuid.UUID
581+ MessageExpirationDuration time.Duration
582+ Source string
583583}
584584
585585// ScheduleExpirationCheck schedules an event to check if a message is expired
@@ -589,27 +589,27 @@ func (service *MessageService) ScheduleExpirationCheck(ctx context.Context, para
589589
590590 ctxLogger := service .tracer .CtxLogger (service .logger , span )
591591
592- if params .MessageExpirationTimeout == 0 {
592+ if params .MessageExpirationDuration == 0 {
593593 ctxLogger .Info (fmt .Sprintf ("message expiration duration not set for message [%s] using phone [%s]" , params .MessageID , params .PhoneID ))
594594 return nil
595595 }
596596
597597 event , err := service .createMessageSendExpiredCheckEvent (params .Source , events.MessageSendExpiredCheckPayload {
598598 MessageID : params .MessageID ,
599- ScheduledAt : params .NotificationSentAt .Add (params .MessageExpirationTimeout ),
599+ ScheduledAt : params .NotificationSentAt .Add (params .MessageExpirationDuration ),
600600 UserID : params .UserID ,
601601 })
602602 if err != nil {
603603 msg := fmt .Sprintf ("cannot create event [%s] for message with id [%s]" , events .EventTypeMessageSendExpiredCheck , params .MessageID )
604604 return service .tracer .WrapErrorSpan (span , stacktrace .Propagate (err , msg ))
605605 }
606606
607- if err = service .eventDispatcher .DispatchWithTimeout (ctx , event , params .MessageExpirationTimeout ); err != nil {
607+ if err = service .eventDispatcher .DispatchWithTimeout (ctx , event , params .MessageExpirationDuration ); err != nil {
608608 msg := fmt .Sprintf ("cannot dispatch event [%s] for message with ID [%s]" , event .Type (), params .MessageID )
609609 return service .tracer .WrapErrorSpan (span , stacktrace .Propagate (err , msg ))
610610 }
611611
612- ctxLogger .Info (fmt .Sprintf ("scheduled message id [%s] to expire at [%s]" , params .MessageID , params .NotificationSentAt .Add (params .MessageExpirationTimeout )))
612+ ctxLogger .Info (fmt .Sprintf ("scheduled message id [%s] to expire at [%s]" , params .MessageID , params .NotificationSentAt .Add (params .MessageExpirationDuration )))
613613 return nil
614614}
615615
0 commit comments