diff --git a/examples/AnalyticsReactNativeExample/ios/AnalyticsReactNativeExample.xcodeproj/project.pbxproj b/examples/AnalyticsReactNativeExample/ios/AnalyticsReactNativeExample.xcodeproj/project.pbxproj index ddcd9956..586ea313 100644 --- a/examples/AnalyticsReactNativeExample/ios/AnalyticsReactNativeExample.xcodeproj/project.pbxproj +++ b/examples/AnalyticsReactNativeExample/ios/AnalyticsReactNativeExample.xcodeproj/project.pbxproj @@ -602,7 +602,11 @@ "-DFOLLY_MOBILE=1", "-DFOLLY_USE_LIBCPP=1", ); - OTHER_LDFLAGS = "$(inherited)"; + OTHER_LDFLAGS = ( + "$(inherited)", + "-Wl", + "-ld_classic", + ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; }; @@ -672,7 +676,11 @@ "-DFOLLY_MOBILE=1", "-DFOLLY_USE_LIBCPP=1", ); - OTHER_LDFLAGS = "$(inherited)"; + OTHER_LDFLAGS = ( + "$(inherited)", + "-Wl", + "-ld_classic", + ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; diff --git a/examples/AnalyticsReactNativeExample/ios/Podfile.lock b/examples/AnalyticsReactNativeExample/ios/Podfile.lock index 50e2099e..afbfa797 100644 --- a/examples/AnalyticsReactNativeExample/ios/Podfile.lock +++ b/examples/AnalyticsReactNativeExample/ios/Podfile.lock @@ -499,7 +499,7 @@ PODS: - RNScreens (3.27.0): - RCT-Folly (= 2021.07.22.00) - React-Core - - segment-analytics-react-native (2.19.3): + - segment-analytics-react-native (2.19.4): - React-Core - sovran-react-native - SocketRocket (0.6.1) @@ -752,7 +752,7 @@ SPEC CHECKSUMS: RNCMaskedView: 0e1bc4bfa8365eba5fbbb71e07fbdc0555249489 RNGestureHandler: 32a01c29ecc9bb0b5bf7bc0a33547f61b4dc2741 RNScreens: 3c2d122f5e08c192e254c510b212306da97d2581 - segment-analytics-react-native: a803de6a9406f7b18928d352962c2f49663a0869 + segment-analytics-react-native: 49ce29a68e86b38c084f1ce07b0c128273d169f9 SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 sovran-react-native: 5f02bd2d111ffe226d00c7b0435290eae6f10934 Yoga: eddf2bbe4a896454c248a8f23b4355891eb720a6 diff --git a/examples/E2E/ios/Podfile.lock b/examples/E2E/ios/Podfile.lock index 36c20f90..d948343e 100644 --- a/examples/E2E/ios/Podfile.lock +++ b/examples/E2E/ios/Podfile.lock @@ -499,11 +499,11 @@ PODS: - RNScreens (3.27.0): - RCT-Folly (= 2021.07.22.00) - React-Core - - segment-analytics-react-native (2.19.2): + - segment-analytics-react-native (2.19.4): - React-Core - sovran-react-native - SocketRocket (0.6.1) - - sovran-react-native (1.1.1): + - sovran-react-native (1.1.2): - React-Core - Yoga (1.14.0) - YogaKit (1.18.1): @@ -752,12 +752,12 @@ SPEC CHECKSUMS: RNCMaskedView: 0e1bc4bfa8365eba5fbbb71e07fbdc0555249489 RNGestureHandler: 32a01c29ecc9bb0b5bf7bc0a33547f61b4dc2741 RNScreens: 3c2d122f5e08c192e254c510b212306da97d2581 - segment-analytics-react-native: 962494a9edbe3f6c5829e3b471484c85c304601c + segment-analytics-react-native: 49ce29a68e86b38c084f1ce07b0c128273d169f9 SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 - sovran-react-native: e6a9c963a8a6b9ebc3563394c39c30f33ab1453f + sovran-react-native: 5f02bd2d111ffe226d00c7b0435290eae6f10934 Yoga: eddf2bbe4a896454c248a8f23b4355891eb720a6 YogaKit: f782866e155069a2cca2517aafea43200b01fd5a PODFILE CHECKSUM: 9d352ca8db1e31a063d2585ed47fdadabf87fe90 -COCOAPODS: 1.15.2 +COCOAPODS: 1.11.3 diff --git a/packages/core/src/plugins/QueueFlushingPlugin.ts b/packages/core/src/plugins/QueueFlushingPlugin.ts index a501a66b..49279366 100644 --- a/packages/core/src/plugins/QueueFlushingPlugin.ts +++ b/packages/core/src/plugins/QueueFlushingPlugin.ts @@ -4,7 +4,7 @@ import { defaultConfig } from '../constants'; import { UtilityPlugin } from '../plugin'; import { PluginType, SegmentEvent } from '../types'; import { createPromise } from '../util'; - +import { ErrorType, SegmentError } from '../errors'; /** * This plugin manages a queue where all events get added to after timeline processing. * It takes a onFlush callback to trigger any action particular to your destination sending events. @@ -20,6 +20,7 @@ export class QueueFlushingPlugin extends UtilityPlugin { private onFlush: (events: SegmentEvent[]) => Promise; private isRestoredResolve: () => void; private isRestored: Promise; + private timeoutWarned = false; /** * @param onFlush callback to execute when the queue is flushed (either by reaching the limit or manually) e.g. code to upload events to your destination @@ -75,12 +76,32 @@ export class QueueFlushingPlugin extends UtilityPlugin { // Wait for the queue to be restored try { await this.isRestored; + + if (this.timeoutWarned === true) { + this.analytics?.logger.info('Flush triggered successfully.'); + + this.timeoutWarned = false; + } } catch (e) { // If the queue is not restored before the timeout, we will notify but not block flushing events - console.info( - 'Flush triggered but queue restoration and settings loading not complete. Flush will be retried.' + this.analytics?.reportInternalError( + new SegmentError( + ErrorType.InitializationError, + 'Queue restoration timeout', + e + ) ); + + if (this.timeoutWarned === false) { + this.analytics?.logger.warn( + 'Flush triggered but queue restoration and settings loading not complete. Flush will be retried.', + e + ); + + this.timeoutWarned = true; + } } + const events = (await this.queueStore?.getState(true))?.events ?? []; if (!this.isPendingUpload) { try {