alibaba / alibaba/coobjc

COPromise 的 cancle 调用没有效果。

Open
#110 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Objective-C
Stars
4k
Forks
519
PR merge metrics
No merged PRs in 30d

Description

### 如题,协程的取消Cancle需要怎么使用,目前调用没有效果?

```objc
/**
Cancel the job.

@discussion If you want a `COPromise` be cancellable, you must make the job cancel in `onCancel:`.
*/
- (void)cancel;

/**
Set the onCancelBlock.

@param onCancelBlock will execute on the promise cancelled.
*/
- (void)onCancel:(COPromiseOnCancelBlock _Nullable )onCancelBlock;
```

#### 目前,如下两种方式,均没有效果: cancle 并没被调用,没有日志输出。

![image](https://user-images.githubusercontent.com/9857312/127453302-54d3de0b-ee48-4f6a-b93c-fce06b9b5733.png)

Contributor guide

Open the contributing guide

Research direction

Start with the COPromise cancel and onCancel: APIs shown in the issue, then reproduce both reported usage patterns from the attached image. Trace whether cancellation reaches the registered onCancel block and compare the observed behavior with the API discussion; done means the cancellation callback executes as expected or the issue is clarified with a minimal reproducible case.

Written by the indexing model from the issue text.

Assessment

Tech stack
objective-c
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.