Using additional API call to be able to call https://api.apify.com/v2/acts/{actorId}/runs/{runId}/abort in both cases.
In the async version it results in last_run method being async (should not be released as patch version).
Copied from source code (Actor run):
# Note:
# The API does not provide a direct endpoint for aborting the last Actor run using a URL like:
# https://api.apify.com/v2/acts/{actor_id}/runs/last/abort
# To achieve this, we need to implement a workaround using the following URL format:
# https://api.apify.com/v2/acts/{actorId}/runs/{runId}/abort
Copied from source code (task run):
# Note:
# The API does not provide a direct endpoint for aborting the last task run using a URL like:
# https://api.apify.com/v2/actor-tasks/{task_id}/runs/last/abort
# To achieve this, we need to implement a workaround using the following URL format:
# https://api.apify.com/v2/acts/{actorId}/runs/{runId}/abort
Testing
As we do not have a proper testing framework here, it was tested just manually with the code examples provided at the beginning.
Problem description
Aborting the last Actor run does not work
Resulting in:
Code to reproduce it:
Aborting of the last task run does not work
Resulting in:
Code to reproduce it:
Related issues
Solution
https://api.apify.com/v2/acts/{actorId}/runs/{runId}/abort
in both cases.last_run
method beingasync
(should not be released as patch version).Testing