JuliaWeb/GitHub.jl

POST operations need to handle intermittent network failure.

オープン

#106 opened on 2018/03/17

 (5 件のコメント) (2 件のリアクション) (0 人の担当者)Julia (62 件のフォーク)github user discovery
help wantedpriority

Repository metrics

Stars
 (174 個のスター)
PR merge metrics
 (平均マージ 2d 9h) (30d で 1 merged PR)

説明

The GitHub doc says that they have been careful to use HTTP methods with semantics appropriate to the API operations.

HTTP.jl retries most request automatically in the event of network failure. However, POST operations are not generally idempotent and cannot be automatically retried. GitHub.jl should implement system-state-aware retry loops around POST requests. i.e. when a POST operation throws an HTTP.IOError GitHub.jl should retry the operation in a way that avoids duplicate changes to system state.

In the case of the create_status operation that is the subject of https://github.com/JuliaWeb/HTTP.jl/issues/220, POST /repos/:owner/:repo/statuses/:sha, it seems that double-posting would create two statuses, https://developer.github.com/v3/repos/statuses/, so in the event of a failure, the GitHub.jl create_status function should do a GET to check if the status was created before retrying (or, if duplicate statuses are not considered harmful to overall system correctness, just set retry_non_idempotent=true).

https://github.com/JuliaWeb/GitHub.jl/blob/beb3659dc0d43b29354fcf909de1b453e248b37c/src/repositories/statuses.jl#L30-L33

See also https://github.com/JuliaWeb/HTTP.jl/issues/214.

This issue may apply in other places that use gh_post_json.

コントリビューターガイド