Description
In Source/ARTRestChannel.m around lines 241-244, the history: method uses art_dispatch_sync(_queue, ...) which creates a deadlock risk and blocks the calling thread unnecessarily.
Problem
- Deadlock Risk: If
history: is called from code already executing on _queue, it will deadlock
- Blocking: Using sync dispatch blocks the caller's thread when the work is being dispatched asynchronously anyway
- Inconsistency: Similar paginated methods in the codebase use
art_dispatch_async:
- ARTRestPresence.m (lines 171, 237)
- ARTRest.m (lines 771, 845)
Expected Behavior
The method should use art_dispatch_async(_queue, ^{ ... }) to match the pattern used in similar paginated methods.
Code Location
// Current (incorrect):
art_dispatch_sync(_queue, ^{
[ARTPaginatedResult executePaginated:self->_rest withRequest:request andResponseProcessor:responseProcessor wrapperSDKAgents:wrapperSDKAgents logger:self.logger callback:callback];
});
// Should be:
art_dispatch_async(_queue, ^{
[ARTPaginatedResult executePaginated:self->_rest withRequest:request andResponseProcessor:responseProcessor wrapperSDKAgents:wrapperSDKAgents logger:self.logger callback:callback];
});
Context
This issue was identified during code review of PR #2164 and confirmed to be legacy code that should be fixed.
Related:
┆Issue is synchronized with this Jira Bug by Unito
Description
In
Source/ARTRestChannel.maround lines 241-244, thehistory:method usesart_dispatch_sync(_queue, ...)which creates a deadlock risk and blocks the calling thread unnecessarily.Problem
history:is called from code already executing on_queue, it will deadlockart_dispatch_async:Expected Behavior
The method should use
art_dispatch_async(_queue, ^{ ... })to match the pattern used in similar paginated methods.Code Location
Context
This issue was identified during code review of PR #2164 and confirmed to be legacy code that should be fixed.
Related:
┆Issue is synchronized with this Jira Bug by Unito