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

Add serialization service support #840

Merged
merged 8 commits into from
Aug 6, 2019
Merged

Add serialization service support #840

merged 8 commits into from
Aug 6, 2019

Conversation

kevcunnane
Copy link
Contributor

@kevcunnane kevcunnane commented Aug 1, 2019

Add serialization service support

  • Added a method that handles serialization requests
  • Support splitting save over multiple requests to reduce overall message size
  • Added unit tests

String changes used a new version of the string tool for generation.
Will publish PR separately for the changes to build & localization
so this can run on Mac without .Net Core 1.0

Not covered yet:

  • Excel testing. This is a bit complex to set up compared to the others
  • Negative tests (exception cases).

- Added a method that handles serialization requests
- Support splitting save over multiple requests to reduce overall message size
- Added unit tests

Tests for Excel are not currently added as they're more cumbersome to write than others
String changes used a new version of the string tool for generation.
Will publish PR separately for the changes to build & localization
so this can run on Mac without .Net Core 1.0
- This had been added in error
if (serializeParams.IsComplete)
{
this.CloseStreams();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems odd to do the cleanup here - wouldn't most things only call this request once? I would expect that after serialization is complete the streams would be automatically closed

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok so looking at it more it seems like this will get multiple requests in batches for a single file (which makes sense). I guess this is fine but I'm not completely sold on the IsComplete name - IsLast seemed to make more sense to me. But IsLast isn't great either - maybe IsLastBatch? I'd also put a comment about keeping the streams open until we get told that all the data is transferred since it's otherwise unclear that this is a batched operation.


In reply to: 309756726 [](ancestors = 309756726)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack, will consider renaming.

DataSerializer serializer = null;
bool hasSerializer = inProgressSerializations.TryGetValue(serializeParams.FilePath, out serializer);
if (!hasSerializer)
{
Copy link
Contributor

@Charles-Gagnon Charles-Gagnon Aug 1, 2019

Choose a reason for hiding this comment

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

Are requests actually multithreaded? If so this has a small chance for a race condition - if there isn't a serializer when we set hasSerializer but then another thread comes in and makes one before AddOrUpdate is called then we'll end up having two serializers for the same file. And generally this kind of check is an anti-pattern anyways.

I'd just create the new serializer and use TryAdd (ignoring if it already exists), simpler and avoids the possible race condition

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So my current thinking here is that the client will wait on the result from each call before sending more across. I believe given this, it should be fine.
I think to fix, we'd want to separate into 2 messages (start and update) and fail on start if another serializer existed. That would handle cases, for example, where folks clicked save twice. Let me take a look at this and think on it - this may be more robust against multiple requests.

Copy link
Contributor

@Charles-Gagnon Charles-Gagnon left a comment

Choose a reason for hiding this comment

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

:shipit:

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 60.066% when pulling 60cd193 on feat/serialization into e0cce70 on master.

@kevcunnane kevcunnane merged commit 7ef82fe into master Aug 6, 2019
@kevcunnane kevcunnane deleted the feat/serialization branch August 6, 2019 23:50
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

3 participants