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

handle sync PUT errors #150

Merged
merged 2 commits into from Jul 18, 2017
Merged

handle sync PUT errors #150

merged 2 commits into from Jul 18, 2017

Conversation

@diracdeltas
Copy link
Member

diracdeltas commented Jul 17, 2017

fix #149

@diracdeltas diracdeltas self-assigned this Jul 17, 2017
@diracdeltas diracdeltas requested review from ayumi and bsclifton Jul 17, 2017
@ayumi
ayumi approved these changes Jul 17, 2017
Copy link
Contributor

ayumi left a comment

Tested on browser-laptop 5e37a1d31d3a3e15d53209a0ca62703d7cb577f0 to sync 6K bookmarks across 2 pyramids.

I'm not sure if this will solve the original error, but it should help with debugging.

@bsclifton
Copy link
Member

bsclifton commented Jul 17, 2017

I'm new to this code, but I wonder if it would make sense to check here too?
https://github.com/brave/sync/blob/fix/149/client/requestUtil.js#L231
(ex: if record is falsey, noop)

@ayumi
Copy link
Contributor

ayumi commented Jul 17, 2017

@bsclifton that sounds reasonable – maybe console.log a warning and return a Promise which resolves immediately

@diracdeltas
Copy link
Member Author

diracdeltas commented Jul 17, 2017

@bsclifton i think if record is falsey it should throw an error because that shouldn't happen. in that case, the caller catches the error and it's a no-op anyway.

@diracdeltas
Copy link
Member Author

diracdeltas commented Jul 17, 2017

also if record is falsey, i think https://github.com/brave/sync/pull/150/files#diff-6ce8437e6c27185736d22013ce441e15R135 will throw an error and bufferedPut won't be called in the first place

@@ -131,14 +131,20 @@ const startSync = (requester) => {
logSync(`Sending ${records.length} records`)
const categoryId = proto.categories[category]
records.forEach((record) => {
if (!record) {
return

This comment has been minimized.

Copy link
@ayumi

ayumi Jul 18, 2017

Contributor

should we be logging a warning here? falsey record is not to be expected

and check that record is non-empty
@diracdeltas diracdeltas force-pushed the fix/149 branch from e25d154 to ce3bcc1 Jul 18, 2017
@diracdeltas
Copy link
Member Author

diracdeltas commented Jul 18, 2017

the issue @bsclifton experienced seems to be due to our version of protobufjs not accepting null as a valid value for a string proto field. dealing with that now.

@diracdeltas
Copy link
Member Author

diracdeltas commented Jul 18, 2017

working on test brokenness

@diracdeltas diracdeltas force-pushed the fix/149 branch from 99ef311 to c861458 Jul 18, 2017
if (data.fields && data.fields.length > 0) {
object[type] = pickFields(data, data.fields)
// Empty the fields field for backwards compatibility with protobufjs 6.6

This comment has been minimized.

Copy link
@diracdeltas

diracdeltas Jul 18, 2017

Author Member

@ayumi is this needed? the fields field seems to always be empty with protobufjs 6.6 but it is populated with the correct fields in 6.8. however, it is expected to be empty for the tests to pass.

This comment has been minimized.

Copy link
@ayumi

ayumi Jul 18, 2017

Contributor

i don't remember the details. what i do remember is pbjs didn't distinguish between props with unset default value versus fields explicitly set with that default value

so I added fields to explicitly track which fields were set.

Copy link
Member

bsclifton left a comment

This worked perfectly! 😄 I just tried it with my session that was previously failing. All records sent with no errors 👍

@diracdeltas diracdeltas merged commit 74b83b9 into staging Jul 18, 2017
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@diracdeltas diracdeltas deleted the fix/149 branch Jul 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants
You can’t perform that action at this time.