Skip to content

Commit 6154833

Browse files
committed
fix: main.go: Add alert ID to post key
The post key in BadgerDB was updated to include the alert ID to prevent conflicts when processing posts from multiple alerts.
1 parent 4227794 commit 6154833

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func checkForNewAlert() {
116116
slices.Reverse(res.ListWidgets)
117117
for _, post := range res.ListWidgets {
118118
// check if post is already in database
119-
key := fmt.Sprintf("post-%s", post.Data.Token)
119+
key := fmt.Sprintf("post-%s-%d", post.Data.Token, alert.Id)
120120
_, err := txn.Get([]byte(key))
121121
if errors.Is(err, badger.ErrKeyNotFound) {
122122
// post not found, save it to database

0 commit comments

Comments
 (0)