Skip to content

Commit

Permalink
chore(api): retry put comments requests (#297)
Browse files Browse the repository at this point in the history
* chore(api): retry put comments requests
  • Loading branch information
joe-prosser authored Aug 5, 2024
1 parent 9afc496 commit 255c5bf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Unreleased
- Retry when putting comments
- Add ability to get email by id
- Add ability to upload attachment content for comments

Expand Down
9 changes: 7 additions & 2 deletions api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,12 +522,15 @@ impl Client {
comments: Vec<NewComment>,
no_charge: bool,
) -> Result<SplitableRequestResponse<PutCommentsResponse>> {
// Retrying here despite the potential for 409's in order to increase reliability when
// working with poor connection

self.splitable_request(
Method::PUT,
self.endpoints.put_comments(source_name)?,
PutCommentsRequest { comments },
Some(NoChargeQuery { no_charge }),
Retry::No,
Retry::Yes,
)
}

Expand All @@ -537,12 +540,14 @@ impl Client {
comments: Vec<NewComment>,
no_charge: bool,
) -> Result<PutCommentsResponse> {
// Retrying here despite the potential for 409's in order to increase reliability when
// working with poor connection
self.request(
&Method::PUT,
&self.endpoints.put_comments(source_name)?,
&Some(PutCommentsRequest { comments }),
&Some(NoChargeQuery { no_charge }),
&Retry::No,
&Retry::Yes,
)
}

Expand Down

0 comments on commit 255c5bf

Please sign in to comment.