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

Renew event ID when event object is reused (close #390) #391

Merged
merged 1 commit into from
Jun 24, 2020

Conversation

AlexBenny
Copy link
Contributor

The event ID is set in the event constructor. We want the event ID set when the event is tracked. Unless the user has set it programmatically.

@AlexBenny AlexBenny self-assigned this Jun 16, 2020
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 75.06% when pulling 2941298 on issue/390-renew_eventid_when_reused into d8ea489 on release/1.5.0.

Copy link
Contributor

@paulboocock paulboocock left a comment

Choose a reason for hiding this comment

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

Curious about the new depracted methods. Other than that this looks good and I'll approve once I understand a little more about those.

public long getDeviceCreatedTimestamp() {
return this.deviceCreatedTimestamp;
if (deviceCreatedTimestamp == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure why we have introduced a side effect in this function and then made a new function to get the unchanged version. Whats the plan for v2?

/**
* Get the actual timestamp of the event.
* @apiNote It doesn't have the side effect of {@link #getDeviceCreatedTimestamp()}.
* @deprecated As of release 1.5.0, it will be removed in the version 2.0.0.
Copy link
Contributor

Choose a reason for hiding this comment

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

It also seems odd to introduce deprecated methods...

/**
* Get the actual event id of the event.
* @apiNote It doesn't have the side effect of {@link #getEventId()}.
* @deprecated As of release 1.5.0, it will be removed in the version 2.0.0.
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comments here as above.

@AlexBenny
Copy link
Contributor Author

Thanks @paulboocock , all these comments are related to a design issue.
Normally the event object has a timestamp and an eventId assigned. That can cause duplications if the same object is reused multiple times.
I moved the eventId and timestamp assignment into the tracker rather than the event constructor.
Unfortunately, these are public API so I can't change the contract of the getEventId and getDeviceCreatedTimestamp. They have to return a non-null value and I have to let the user set them as usual if they want (until v.2.0).

In brief:

  • the side effect exists because I can't change the behaviour of the two old get methods
  • the two new methods return the "actual" values because Event is an interface and I can access eventId and timestamp only by methods (no properties on interfaces)
  • everything is deprecated because the v.2.0 of Event interface will not have any trace of eventID and timestamp, so no need of the old and new methods!

Copy link
Contributor

@paulboocock paulboocock left a comment

Choose a reason for hiding this comment

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

Ok, that's a good enough excuse for me. 2.0.0 can't come soon enough :-)

LGTM.

@AlexBenny AlexBenny merged commit 11b3c67 into release/1.5.0 Jun 24, 2020
@AlexBenny AlexBenny deleted the issue/390-renew_eventid_when_reused branch June 24, 2020 11:45
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