Skip to content
This repository has been archived by the owner on Nov 23, 2019. It is now read-only.

Stop Generating MessageId #55

Merged
merged 3 commits into from
Mar 8, 2019
Merged

Stop Generating MessageId #55

merged 3 commits into from
Mar 8, 2019

Conversation

jlee9595
Copy link
Contributor

@jlee9595 jlee9595 commented Mar 7, 2019

@jlee9595 jlee9595 requested a review from f2prateek March 7, 2019 22:02
@@ -12,7 +12,6 @@ var integration = require('@segment/analytics.js-integration');
var json = require('json3');
var keys = require('@ndhoule/keys');
var localstorage = require('yields-store');
var md5 = require('spark-md5').hash;
var protocol = require('@segment/protocol');
Copy link
Contributor

Choose a reason for hiding this comment

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

do we still need the uuid dependency?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

ah ok 👍

@f2prateek
Copy link
Contributor

Code LGTM!

I think we should update the version of a.js core as a dev here and add a test to verify it picks the messageId from whatever a.js provides.

One more thing we can consider to reduce risk is to leave the generation logic as is, but make it check the root message first.

msg.messageId = msg.messageId || 'ajs-' + md5(json.stringify(msg) + uuid());

@@ -425,6 +410,13 @@ describe('Segment.io', function() {
assert(!object._metadata);
});
});

it('should pick up messageId from AJS', function() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@f2prateek Is this along the lines of what you were looking for?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep!

@f2prateek
Copy link
Contributor

(looks like some lint errors were flagged in CI, let's get those fixed before merging too)

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

Successfully merging this pull request may close these issues.

2 participants