Skip to content

Commit

Permalink
fix: retriable exceptions are deterministically ordered in GAPICs (#619)
Browse files Browse the repository at this point in the history
Certain code patterns in the generated surface are created by
iteration over data collections. This iteration order should be
deterministic in order to prevent spurious deltas in the generated surface.
  • Loading branch information
software-dov authored Sep 24, 2020
1 parent 1756891 commit f7b1164
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,9 @@ class {{ service.name }}Transport(metaclass=abc.ABCMeta):
{% if method.retry.max_backoff %}maximum={{ method.retry.max_backoff }},{% endif %}
{% if method.retry.backoff_multiplier %}multiplier={{ method.retry.backoff_multiplier }},{% endif %}
predicate=retries.if_exception_type(
{%- filter sort_lines %}
{%- for ex in method.retry.retryable_exceptions %}
{%- for ex in method.retry.retryable_exceptions|sort(attribute='__name__) %}
exceptions.{{ ex.__name__ }},
{%- endfor %}
{%- endfilter %}
),
),
{%- endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,9 @@ class {{ service.async_client_name }}:
{% if method.retry.max_backoff %}maximum={{ method.retry.max_backoff }},{% endif %}
{% if method.retry.backoff_multiplier %}multiplier={{ method.retry.backoff_multiplier }},{% endif %}
predicate=retries.if_exception_type(
{%- filter sort_lines %}
{%- for ex in method.retry.retryable_exceptions %}
{%- for ex in method.retry.retryable_exceptions|sort(attribue='__name__') %}
exceptions.{{ ex.__name__ }},
{%- endfor %}
{%- endfilter %}
),
),
{%- endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,9 @@ class {{ service.name }}Transport(abc.ABC):
{% if method.retry.max_backoff %}maximum={{ method.retry.max_backoff }},{% endif %}
{% if method.retry.backoff_multiplier %}multiplier={{ method.retry.backoff_multiplier }},{% endif %}
predicate=retries.if_exception_type(
{%- filter sort_lines %}
{%- for ex in method.retry.retryable_exceptions %}
{%- for ex in method.retry.retryable_exceptions|sort(attribute='__name__') %}
exceptions.{{ ex.__name__ }},
{%- endfor %}
{%- endfilter %}
),
),
{%- endif %}
Expand Down

0 comments on commit f7b1164

Please sign in to comment.