Skip to content

Commit 2e38c9f

Browse files
committed
Retry task only if task is not cancelled.
1 parent 917d709 commit 2e38c9f

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

STNetTaskQueue/STNetTaskQueue.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,10 @@ - (BOOL)_retryTask:(STNetTask *)task withError:(NSError *)error
125125

126126
- (void)_retryTask:(STNetTask *)task
127127
{
128-
[task didRetry];
129-
[self addTask:task];
128+
if (!task.cancelled) {
129+
[task didRetry];
130+
[self addTask:task];
131+
}
130132
}
131133

132134
- (void)_sendWatingTasks

STNetTaskQueueTest/STNetTaskQueueTest/STNetTaskQueueTestHTTP.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ - (void)testCancelNetTask
6060
{
6161
[self setUpNetTaskQueueWithBaseURLString:@"http://jsonplaceholder.typicode.com"];
6262

63-
_expectation = [self expectationWithDescription:@"testRetryNetTask"];
63+
_expectation = [self expectationWithDescription:@"testCancelNetTask"];
6464

6565
STTestRetryNetTask *testRetryTask = [STTestRetryNetTask new];
6666
[[STNetTaskQueue sharedQueue] addTaskDelegate:self uri:testRetryTask.uri];

0 commit comments

Comments
 (0)