Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meilisync loses event when both create and update occur for the same primary key in an interval #92

Open
rishabhc32 opened this issue Mar 27, 2024 · 1 comment

Comments

@rishabhc32
Copy link

If I have an interval of, let's suppose, 10 seconds and insert size of 1000 documents, and within that interval, a create event is first received followed by an update event for the same primary key, the current implementation of Meilisync's event buffer leads to the create event being overwritten by the update event.

def add_event(self, sync: Sync, event: Event):
pk = event.data[sync.pk]
self._events.setdefault(sync, {})
self._events[sync][pk] = event

self._events[sync][pk] = event here the event will get overwritten.

A potential solution could involve modifying the event handling logic to append events rather than overwrite them, for instance:

self._events[sync][pk].append(event)

Or we could just do:

self._events[sync].append(event)
@rishabhc32
Copy link
Author

rishabhc32 commented May 31, 2024

@long2ice Would you be interested in a PR where a solution like self._events[sync][pk].append(event) is implemented?
This will preserve the order of the events on a primary key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant