Commit febb478f authored by Ikram Haq's avatar Ikram Haq
Browse files

Implement logic to handle reporting amount of notification for periodic based subscription

parent ae951390
Loading
Loading
Loading
Loading
+17 −5
Original line number Diff line number Diff line
@@ -1253,12 +1253,24 @@ func checkNotificationPeriodicTrigger1() {
			// Update NextTts for the next notification
			periodicCheck.NextTts = int32(currentTime + reportingIntervalInSeconds)

			// Check if reporting amount is reached
			if periodicCheck.Reporting_amount <= 0 {
				// If reporting amount is zero, no more notifications should be sent
				continue
			}

			// Decrement reporting amount
			periodicCheck.Reporting_amount--
			if periodicCheck.Reporting_amount != 0 {
				// Prepare and send the notification
				sendNotification(subsId, periodicCheck)

				// Log the notification
				subsIdStr := strconv.Itoa(subsId)
				log.Info("Periodic Notification (" + subsIdStr + ") For " + addr)
			} else {
				continue
			}
		}
	}
}