@@ -841,11 +841,13 @@ - (void)_addDelegate:(id<MTRDeviceDelegate>)delegate queue:(dispatch_queue_t)que
841
841
#endif
842
842
843
843
if (shouldSetUpSubscription) {
844
+ MTR_LOG (" %@ - starting subscription setup" , self);
844
845
// Record the time of first addDelegate call that triggers initial subscribe, and do not reset this value on subsequent addDelegate calls
845
846
if (!_initialSubscribeStart) {
846
847
_initialSubscribeStart = [NSDate now ];
847
848
}
848
849
if ([self _deviceUsesThread ]) {
850
+ MTR_LOG (" => %@ - device is a thread device, scheduling in pool" , self);
849
851
[self _scheduleSubscriptionPoolWork: ^{
850
852
std::lock_guard lock (self->_lock );
851
853
[self _setupSubscriptionWithReason: @" delegate is set and scheduled subscription is happening" ];
@@ -1298,7 +1300,7 @@ - (void)_scheduleSubscriptionPoolWork:(dispatch_block_t)workBlock inNanoseconds:
1298
1300
1299
1301
// Sanity check we are not scheduling for this device multiple times in the pool
1300
1302
if (_subscriptionPoolWorkCompletionBlock) {
1301
- MTR_LOG_ERROR (" %@ already scheduled in subscription pool for this device - ignoring: %@" , self, description);
1303
+ MTR_LOG (" %@ already scheduled in subscription pool for this device - ignoring: %@" , self, description);
1302
1304
return ;
1303
1305
}
1304
1306
@@ -1307,6 +1309,7 @@ - (void)_scheduleSubscriptionPoolWork:(dispatch_block_t)workBlock inNanoseconds:
1307
1309
// In the case where a resubscription triggering event happened and already established, running the work block should result in a no-op
1308
1310
MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc ] initWithQueue: self .queue];
1309
1311
[workItem setReadyHandler: ^(id _Nonnull context, NSInteger retryCount, MTRAsyncWorkCompletionBlock _Nonnull completion) {
1312
+ MTR_LOG (" %@ - work item is ready to attempt pooled subscription" , self);
1310
1313
os_unfair_lock_lock (&self->_lock );
1311
1314
#ifdef DEBUG
1312
1315
[self _callDelegatesWithBlock: ^(id testDelegate) {
@@ -1332,6 +1335,7 @@ - (void)_scheduleSubscriptionPoolWork:(dispatch_block_t)workBlock inNanoseconds:
1332
1335
workBlock ();
1333
1336
}];
1334
1337
[self ->_deviceController.concurrentSubscriptionPool enqueueWorkItem: workItem description: description];
1338
+ MTR_LOG (" %@ - enqueued in the subscription pool" , self);
1335
1339
});
1336
1340
}
1337
1341
0 commit comments