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

Use Event.import instead of making N save calls #749

Merged
merged 5 commits into from
Aug 18, 2020

Conversation

mpraglowski
Copy link
Member

This will lower number of SQL calls from N+2
to 3 (in best case) (where N is number of events).

This will lower number of SQL calls from N+2
to 3 (in best case) (where N is number of events).
All the rest will be handled by activerecord-import.
@mostlyobvious
Copy link
Member

For a brief moment I was worried about atomicity of adding events after these changes but there is a transaction block hidden inside add_to_stream.

@mostlyobvious
Copy link
Member

I also realized that to_event_id.call(element) might have been a relict of database-generated uuids which we do not or want utilize in any way but maybe an author had this on thier mind.

@mostlyobvious
Copy link
Member

Getting rid of to_event_id.call(element) first would have been much appreciated for review comfort ;)

@mostlyobvious mostlyobvious merged commit 8a6ba1c into master Aug 18, 2020
@mostlyobvious mostlyobvious deleted the avoid-N+2-db-calls branch August 18, 2020 11:31
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

Successfully merging this pull request may close these issues.

2 participants