Skip to content

Commit

Permalink
Updated Notifications (#141)
Browse files Browse the repository at this point in the history
Updated Notification ID's to make them unique and avoid id collision in
the new shared OpenSearch index
  • Loading branch information
amcgreevy-r7 authored Jun 4, 2024
1 parent 3c18ec4 commit 6eb4e8a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions services/notifier/notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (self Nofitier) ListenForNotification(id string) (chan bool, func()) {

logger := logging.GetLogger(self.config_obj, &logging.GUIComponent)
ctx, cancel := context.WithCancel(context.Background())

notify_id := id + "_notify"
go func() {
defer close(output_chan)

Expand All @@ -38,7 +38,7 @@ func (self Nofitier) ListenForNotification(id string) (chan bool, func()) {

case <-time.After(self.poll):
serialized, err := cvelo_services.GetElasticRecord(
ctx, self.config_obj.OrgId, "persisted", id)
ctx, self.config_obj.OrgId, "persisted", notify_id)
if err != nil {
continue
}
Expand All @@ -64,11 +64,12 @@ func (self Nofitier) ListenForNotification(id string) (chan bool, func()) {
func (self Nofitier) NotifyListener(
ctx context.Context,
config_obj *config_proto.Config, id, tag string) error {
notify_id := id + "_notify"
return cvelo_services.SetElasticIndex(
context.Background(), self.config_obj.OrgId,
"persisted", id,
"persisted", notify_id,
&api.NotificationRecord{
Key: id,
Key: notify_id,
Timestamp: time.Now().Unix(),
DocType: "notifications",
})
Expand Down

0 comments on commit 6eb4e8a

Please sign in to comment.