Skip to content

feat: add async_mode param to AsyncERClient.delete_source#51

Merged
chrisdoehring merged 4 commits into
mainfrom
feat/async-delete-source
Mar 20, 2026
Merged

feat: add async_mode param to AsyncERClient.delete_source#51
chrisdoehring merged 4 commits into
mainfrom
feat/async-delete-source

Conversation

@victorlujanearthranger

Copy link
Copy Markdown
Contributor

Summary

  • Adds async_mode: bool = True parameter to AsyncERClient.delete_source
  • When True (default), passes ?async=true to EarthRanger so deletions are processed asynchronously

Test plan

  • Call delete_source without async_mode — verify request includes ?async=true (default)
  • Call delete_source with async_mode=False — verify request has no async param

🤖 Generated with Claude Code

Passes ?async=true query param when async_mode=True (the default).
Source deletion can be time-consuming on the ER side, so async is
the expected behavior for callers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread erclient/client.py Outdated
return await self._delete(f'subject/{subject_id}/')

async def delete_source(self, source_id):
async def delete_source(self, source_id, async_mode: bool = True):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably want this to be sync by default.

Suggested change
async def delete_source(self, source_id, async_mode: bool = True):
async def delete_source(self, source_id, async_mode: bool = False):

@chrisdoehring chrisdoehring left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@victorlujanearthranger I think we should probably make the delete synchronous by default. Let me know what you think about switching that.

Per code review feedback, synchronous should be the default behavior.
Callers that want async deletion can explicitly pass async_mode=True.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@victorlujanearthranger

Copy link
Copy Markdown
Contributor Author

Fixed — changed the default to synchronous (). Callers that want async behavior can still pass explicitly.

chrisdoehring
chrisdoehring previously approved these changes Mar 20, 2026
chrisdoehring
chrisdoehring previously approved these changes Mar 20, 2026
@chrisdoehring chrisdoehring dismissed their stale review March 20, 2026 15:34

The merge-base changed after approval.

@chrisdoehring chrisdoehring self-requested a review March 20, 2026 15:34
@chrisdoehring chrisdoehring merged commit 71ffa73 into main Mar 20, 2026
4 checks passed
@chrisdoehring chrisdoehring deleted the feat/async-delete-source branch March 20, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants