Skip to content

Commit fdd8ab6

Browse files
Alda/dispatch event crash (#161)
* Made concurrent queue to serial queue. This was a mistake. We need this to be serial to keep the pendingDispatchEvents set thread safe. * Fixed duplicate os name in the local travis script.
1 parent 92f3a79 commit fdd8ab6

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

OptimizelySDKEventDispatcher/OptimizelySDKEventDispatcher/OPTLYEventDispatcher.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ @interface OPTLYEventDispatcherDefault()
3939
@property (nonatomic, strong) OPTLYDataStore *dataStore;
4040
@property (nonatomic, strong) NSTimer *timer;
4141
@property (nonatomic, strong) OPTLYNetworkService *networkService;
42+
// keep this thread safe by performing actions in dispatchEventQueue
4243
@property (nonatomic, strong) NSMutableSet *pendingDispatchEvents;
4344
@property (nonatomic, assign) NSInteger flushEventAttempts;
4445
@end
@@ -98,7 +99,7 @@ dispatch_queue_t dispatchEventQueue()
9899
static dispatch_queue_t _dispatchEventQueue = nil;
99100
static dispatch_once_t onceToken;
100101
dispatch_once(&onceToken, ^{
101-
_dispatchEventQueue = dispatch_queue_create("com.Optimizely.dispatchEvent", DISPATCH_QUEUE_CONCURRENT);
102+
_dispatchEventQueue = dispatch_queue_create("com.Optimizely.dispatchEvent", DISPATCH_QUEUE_SERIAL);
102103
});
103104
return _dispatchEventQueue;
104105
}

Scripts/local_travis.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ echo 'xcodebuild test -workspace OptimizelySDK.xcworkspace -scheme OptimizelySDK
99
xcodebuild test -workspace OptimizelySDK.xcworkspace -scheme OptimizelySDKiOS -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -sdk iphonesimulator -destination "platform=iOS Simulator,OS=8.4,name=iPad Retina"
1010

1111
echo 'xcodebuild test -workspace OptimizelySDK.xcworkspace -scheme OptimizelySDKiOS -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -sdk iphonesimulator -destination "platform=iOS Simulator,OS=10.1,name=iPhone 7 Plus"'
12-
xcodebuild test -workspace OptimizelySDK.xcworkspace -scheme OptimizelySDKiOS -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -sdk iphonesimulator -destination "platform=iOS Simulator,OS=9.3,name=iPhone 6s,OS=10.1,name=iPhone 7 Plus"
12+
xcodebuild test -workspace OptimizelySDK.xcworkspace -scheme OptimizelySDKiOS -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -sdk iphonesimulator -destination "platform=iOS Simulator,OS=10.1,name=iPhone 7 Plus"
1313

1414
echo 'xcodebuild test -workspace OptimizelySDK.xcworkspace -scheme OptimizelySDKiOS -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -sdk iphonesimulator -destination "platform=iOS Simulator,OS=10.3.1,name=iPhone 7"'
1515
xcodebuild test -workspace OptimizelySDK.xcworkspace -scheme OptimizelySDKiOS -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -sdk iphonesimulator -destination "platform=iOS Simulator,OS=10.3.1,name=iPhone 7"

0 commit comments

Comments
 (0)