Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd9f42d1

Browse files
authored
Retry PUT 409 errors - delete and re-create event
Attempt to address#963I would appreciate a code review here - there might be a more elegant way to address this problem, but it works for my (very limited) use case.
1 parent68c5968 commitd9f42d1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

‎vdirsyncer/storage/dav.py‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,16 @@ async def _put(self, href, item, etag):
587587
asyncdefupdate(self,href,item,etag):
588588
ifetagisNone:
589589
raiseValueError("etag must be given and must not be None.")
590-
href,etag=awaitself._put(self._normalize_href(href),item,etag)
590+
try:
591+
href,etag=self._put(self._normalize_href(href),item,etag)
592+
exceptHTTPErrorase:
593+
ife.response.status_code==409:
594+
dav_logger.debug("Conflict, will delete old event and recreate it.")
595+
self.delete(self._normalize_href(href),etag)
596+
dav_logger.debug("Now trying again")
597+
href,etag=self._put(self._normalize_href(href),item,None)
598+
else:
599+
raisee
591600
returnetag
592601

593602
asyncdefupload(self,item:Item):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp