File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
Leanplum-SDK/Classes/Managers/Networking Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,9 @@ - (NSMutableDictionary *)createArgsDictionary
110110 if ([LPAPIConfig sharedConfig ].token ) {
111111 args[LP_PARAM_TOKEN] = [LPAPIConfig sharedConfig ].token ;
112112 }
113- [args addEntriesFromDictionary: self .params];
113+ if (self.params && self.params .count > 0 ) {
114+ [args addEntriesFromDictionary: self .params];
115+ }
114116
115117 // remove keys that are empty
116118 [args removeObjectForKey: @" " ];
Original file line number Diff line number Diff line change @@ -132,9 +132,16 @@ - (void)saveRequest:(LPRequest *)request
132132 RETURN_IF_TEST_MODE;
133133 if (!request.sent ) {
134134 request.sent = YES ;
135-
135+
136+ NSBlockOperation *saveRequestOperation = [NSBlockOperation new ];
137+ __weak NSBlockOperation *weakOperation = saveRequestOperation;
138+
136139 void (^operationBlock)(void ) = ^void () {
137140 LP_TRY
141+ if ([weakOperation isCancelled ]) {
142+ return ;
143+ }
144+
138145 NSString *uuid = [LPRequestUUIDHelper loadUUID ];
139146 NSInteger count = [LPEventDataManager count ];
140147 if (!uuid || count % LP_MAX_EVENTS_PER_API_CALL == 0 ) {
@@ -152,7 +159,8 @@ - (void)saveRequest:(LPRequest *)request
152159 LP_END_TRY
153160 };
154161
155- [[LPOperationQueue serialQueue ] addOperationWithBlock: operationBlock];
162+ [saveRequestOperation addExecutionBlock: operationBlock];
163+ [[LPOperationQueue serialQueue ] addOperation: saveRequestOperation];
156164 }
157165
158166 [self .countAggregator incrementCount: @" send_eventually_lp" ];
You can’t perform that action at this time.
0 commit comments