-
Notifications
You must be signed in to change notification settings - Fork 13
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
Flush requests queue on opened push event #183
Conversation
we don't miss any user engagement events. In all other cases we will flush the queue | ||
using the flush intervals defined above in `StateManagementConstants` | ||
*/ | ||
return event.metric.name == .OpenedPush ? .task { .flushQueue } : .none |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main change.
@@ -501,7 +509,7 @@ class StateManagementTests: XCTestCase { | |||
let initialState = INITILIZING_TEST_STATE() | |||
let store = TestStore(initialState: initialState, reducer: KlaviyoReducer()) | |||
|
|||
let event = Event(name: .OpenedPush) | |||
let event = Event(name: .OpenedAppMetric) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to non opened push event since it doesn't matter for this test which event we use.
@@ -485,14 +485,22 @@ class StateManagementTests: XCTestCase { | |||
// MARK: - Test enqueue event | |||
|
|||
@MainActor | |||
func testEnqueueEvent() async throws { | |||
func testEnqueueEvents() async throws { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated this test to test all events and added an exception for opened push at the bottom.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks right to me
Description
In order to keep engagement metric as up to date as possible we want to try and flush the queue whenever an opened push event request is enqueued.
Check List
Manual Test Plan
Unit tests but also using a proxy -