fix: async support for save() recurrence handling and complete()#644
Merged
fix: async support for save() recurrence handling and complete()#644
Conversation
save() called get_self() (a sync helper that invokes parent collection methods) even for async clients, but those methods return unawaited coroutines in async mode, causing AttributeError when accessing .icalendar_instance on the coroutine. Fix by delegating to _async_save() at the top of save() when is_async_client is True, with an async get_self() that properly awaits the parent collection methods. Similarly, complete() returned None for async clients (self.save() returned a coroutine that was ignored), so "await task.complete()" raised TypeError: 'NoneType' object can't be awaited. Fix by adding _async_complete() that awaits self.save(). To avoid duplicating the icalendar manipulation logic, extract three shared helpers: - _validate_save_constraints(): raises on no_overwrite/no_create violations - _incorporate_recurrence_into_parent(): merges a recurrence instance into the parent event's icalendar_instance (pure, no I/O) - _maybe_increment_sequence(): increments SEQUENCE if present The now-redundant _async_save_final() is removed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(also related to #642)
save() called get_self() (a sync helper that invokes parent collection
methods) even for async clients, but those methods return unawaited
coroutines in async mode, causing AttributeError when accessing
.icalendar_instance on the coroutine.
Fix by delegating to _async_save() at the top of save() when
is_async_client is True, with an async get_self() that properly awaits
the parent collection methods.
Similarly, complete() returned None for async clients (self.save()
returned a coroutine that was ignored), so "await task.complete()"
raised TypeError: 'NoneType' object can't be awaited. Fix by adding
_async_complete() that awaits self.save().
To avoid duplicating the icalendar manipulation logic, extract three
shared helpers:
into the parent event's icalendar_instance (pure, no I/O)
The now-redundant _async_save_final() is removed.
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com