8000 feat (Optimizely) [OASIS-5907]: close promise tracks in-flight event … · optimizely/javascript-sdk@9fe10a0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9fe10a0

Browse files
authored
feat (Optimizely) [OASIS-5907]: close promise tracks in-flight event dispatcher requests (#404)
Summary: Update to js-sdk-event-processor v0.4.0, which supports tracking in-flight event dispatcher requests in its stop() promise. The close promise (of Optimizely) is based on the event processor's stop promise, so by this upgrade, we get the new functionality. I updated the close doc comment to talk about this new behavior. Test plan: - Existing tests - Manually tested in Node, browser, and Lambda environments Issues: https://optimizely.atlassian.net/browse/OASIS-5907
1 parent e309c25 commit 9fe10a0

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

packages/optimizely-sdk/CHANGELOG.MD

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
88
### Bug fixes
99
- Fixed default event dispatcher not used in React Native entry point ([#383](https://github.com/optimizely/javascript-sdk/pull/383))
1010

11+
### New Features
12+
- Promise returned from `close` tracks the state of in-flight event dispatcher requests ([#404](https://github.com/optimizely/javascript-sdk/pull/404))
13+
1114
## [3.4.1] - January 28th, 2020
1215

1316
### Bug fixes

packages/optimizely-sdk/lib/optimizely/index.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -935,20 +935,21 @@ Optimizely.prototype.getOptimizelyConfig = function() {
935935
* - Pending event queue flushes
936936
*
937937
* In-flight datafile requests will be aborted. Any events waiting to be sent
938-
* as part of a batched event request will be immediately batched and sent to
939-
* the event dispatcher.
938+
* as part of a batched event request will be immediately flushed to the event
939+
* dispatcher.
940940
*
941-
* If any such requests were sent to the event dispatcher, returns a Promise
942-
* that fulfills after the event dispatcher calls the response callback for each
943-
* request. Otherwise, returns an immediately-fulfilled Promise.
941+
* Returns a Promise that fulfills after all in-flight event dispatcher requests
942+
* (including any final request resulting from flushing the queue as described
943+
* above) are complete. If there are no in-flight event dispatcher requests and
944+
* no queued events waiting to be sent, returns an immediately-fulfilled Promise.
944945
*
945946
* Returned Promises are fulfilled with result objects containing these
946947
* properties:
947-
* - success (boolean): true if all events in the queue at the time close was
948-
* called were combined into requests, sent to the
949-
* event dispatcher, and the event dispatcher called the
950-
* callbacks for each request. false if an unexpected
951-
* error was encountered during the close process.
948+
* - success (boolean): true if the event dispatcher signaled completion of
949+
* all in-flight and final requests, or if there were no
950+
* queued events and no in-flight requests. false if an
951+
* unexpected error was encountered during the close
952+
* process.
952953
* - reason (string=): If success is false, this is a string property with
953954
* an explanatory message.
954955
*

packages/optimizely-sdk/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/optimizely-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"homepage": "https://github.com/optimizely/javascript-sdk/tree/master/packages/optimizely-sdk",
3535
"dependencies": {
3636
"@optimizely/js-sdk-datafile-manager": "^0.4.0",
37-
"@optimizely/js-sdk-event-processor": "^0.3.0",
37+
"@optimizely/js-sdk-event-processor": "^0.4.0",
3838
"@optimizely/js-sdk-logging": "^0.1.0",
3939
"@optimizely/js-sdk-utils": "^0.2.0",
4040
"json-schema": "^0.2.3",

0 commit comments

Comments
 (0)
0