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

DM-24355: Make Instrument registration idempotent. #258

Merged
merged 1 commit into from Oct 16, 2020

Conversation

TallJimbo
Copy link
Member

No description provided.

}
)
for detector in self.getCamera():
registry.syncDimensionData("detector", self.extractDetectorRecord(detector))
Copy link
Member

Choose a reason for hiding this comment

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

Did the bulk insert version disappear or something? Previously it built all the records and did one insert, here it does a separate sync for each detector.

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct. syncDimensionData doesn't do bulk. It probably could be made to now with enough effort, but that's a bigger change than I wanted to make on this ticket, and I think for an operation as rare as instrument registration ought to be, a few hundred single-row insert operations is not a big problem. I figured being able to add new detectors (and check for consistency with all existing ones) was more valuable than performance in this context.

A no-op sync is not free, though, and I've tried to document that wherever I could. If people throw calls to Instrument.register and the like everywhere (especially TestCase.setUp) we will regret it.

@TallJimbo TallJimbo merged commit 4d5caa3 into master Oct 16, 2020
@TallJimbo TallJimbo deleted the tickets/DM-24355 branch October 16, 2020 14:27
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.

None yet

2 participants