Skip to content

Conversation

@swalker2m
Copy link
Contributor

There's a report that a simple update to S/N requirements generates up to 13 observation edit events. This PR will attempt to find the issue.

@mergify mergify bot added the service label Feb 12, 2025
@swalker2m swalker2m force-pushed the too-many-events branch 2 times, most recently from ea2f64e to 4b41b32 Compare February 13, 2025 16:46
topic
.subscribe(maxQueued)
.groupWithin(chunkSize, timeout)
.flatMap(Stream.chunk(_).changes)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may not be a great idea after all. By the time the event is fired, the expected subscription query can produce different results than it would have if it had been generated immediately. For example, when a new group is created without specifying a parent index, it defaults to index 0. It may be subsequently moved. Then the group creation event fires after the GroupingTimeout expires. At that point, the index is no longer 0. So you can see a CREATED event with parent index 1 followed by an UPDATED event also at 1 when you expected CREATED at 0 followed up UPDATED showing 1.

{
  "groupEdit" : {
    "editType" : "CREATED",
    "value" : {
      "id" : "g-10c",
      "parentId" : "g-10b",
      "parentIndex" : 1
    }
  }
},
{
  "groupEdit" : {
    "editType" : "UPDATED",
    "value" : {
      "id" : "g-10c",
      "parentId" : "g-10b",
      "parentIndex" : 1
    }
  }
}

I don't know whether this is a problem for production, but it definitely makes tests unpredictable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants