Skip to content

Conversation

@rashidsp
Copy link
Contributor

Summary

  • Introduced LogEvent notification in notification_center.rb.
  • Integrated it in batch_event_dispatcher.rb and forwarding_event_processor.rb.
  • Added notification_count in notification_center.rb and integrated into Optimizely for notification types ACTIVATE and TRACK.

Test plan

  • Added unit tests for LogEvent in notification_center_spec.rb, batch_event_dispatcher_spec.rb and forwarding_event_processor_spec.rb.
  • Updated Optimizely's unit tests for LogEvent and notification_count.

@coveralls
Copy link

coveralls commented Aug 29, 2019

Coverage Status

Coverage increased (+0.02%) to 99.441% when pulling 4375ff7 on rashid/Batch-EP-add-logEvent into 2df63ad on master.

NotificationCenter::NOTIFICATION_TYPES[:TRACK],
event_key, user_id, attributes, event_tags, log_event
)
if @notification_center.notification_count(NotificationCenter::NOTIFICATION_TYPES[:TRACK]).positive?
Copy link

Choose a reason for hiding this comment

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

What do we gain by checking notification count, as opposed to just sending notifications regardless of count?

Copy link
Contributor Author

@rashidsp rashidsp Sep 5, 2019

Choose a reason for hiding this comment

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

This validates that the listener has already been added before sending the notification.
Please view java-sdk as a reference: https://github.com/optimizely/java-sdk/blob/master/core-api/src/main/java/com/optimizely/ab/Optimizely.java#L304

def initialize(
event_queue: SizedQueue.new(DEFAULT_QUEUE_CAPACITY),
event_dispatcher:,
event_dispatcher: Optimizely::EventDispatcher.new,
Copy link

Choose a reason for hiding this comment

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

Why are we adding a default value here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not related to LogEvent, therefore moved to PR: #200


add_to_batch(item) if item.is_a? Optimizely::UserEvent
end
rescue SignalException
Copy link

Choose a reason for hiding this comment

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

This seems like an important change, but it isn't discussed in the summary. Could you explain this change? If this isn't related to LogEvent notification, then I think it should be in its own separate PR.

Copy link
Contributor Author

@rashidsp rashidsp Sep 5, 2019

Choose a reason for hiding this comment

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

Moved changes into PR: #200.

@rashidsp rashidsp requested a review from mjc1283 September 5, 2019 12:22
Copy link

@mjc1283 mjc1283 left a comment

Choose a reason for hiding this comment

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

LGTM

@rashidsp rashidsp requested a review from mjc1283 September 5, 2019 17:20
@mjc1283 mjc1283 merged commit a34512a into master Sep 6, 2019
@rashidsp rashidsp deleted the rashid/Batch-EP-add-logEvent branch September 18, 2019 17:54
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.

4 participants