Skip to content

Commit d8776a2

Browse files
Use string format instead of replace method
1 parent 7680a53 commit d8776a2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

samples/load-balancing/aca-backend-pool-load-balancing.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
<policies>
55
<inbound>
66
<base />
7-
<set-backend-service backend-id="{backend-id}" />
7+
<set-backend-service backend-id="{backend_id}" />
88
</inbound>
99
<backend>
1010
<!--Apply load-balancing and retry mechanisms -->
1111
<!--Set count to one less than the number of backends in the pool to try all backends until the backend pool is temporarily unavailable.-->
12-
<retry count="{retry-count}" interval="0" first-fast-retry="true" condition="@(context.Response.StatusCode == 429 || (context.Response.StatusCode == 503 && !context.Response.StatusReason.Contains("Backend pool") && !context.Response.StatusReason.Contains("is temporarily unavailable")))">
12+
<retry count="{retry_count}" interval="0" first-fast-retry="true" condition="@(context.Response.StatusCode == 429 || (context.Response.StatusCode == 503 && !context.Response.StatusReason.Contains("Backend pool") && !context.Response.StatusReason.Contains("is temporarily unavailable")))">
1313
<forward-request buffer-request-body="true" />
1414
</retry>
1515
</backend>

samples/load-balancing/create.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@
7171
"\n",
7272
"# Policies\n",
7373
"base_policy = './aca-backend-pool-load-balancing.xml'\n",
74-
"aca_backend_pool_prioritized_policy_xml = utils.read_policy_xml(base_policy).replace('{retry-count}', '1').replace('{backend-id}', 'aca-backend-pool-web-api-429-prioritized')\n",
75-
"aca_backend_pool_prioritized_and_weighted_policy_xml = utils.read_policy_xml(base_policy).replace('{retry-count}', '2').replace('{backend-id}', 'aca-backend-pool-web-api-429-prioritized-and-weighted')\n",
76-
"aca_backend_pool_weighted_equal_policy_xml = utils.read_policy_xml(base_policy).replace('{retry-count}', '1').replace('{backend-id}', 'aca-backend-pool-web-api-429-weighted-50-50')\n",
77-
"aca_backend_pool_weighted_unequal_policy_xml = utils.read_policy_xml(base_policy).replace('{retry-count}', '1').replace('{backend-id}', 'aca-backend-pool-web-api-429-weighted-80-20')\n",
74+
"aca_backend_pool_prioritized_policy_xml = utils.read_policy_xml(base_policy).format(retry_count = 1, backend_id = 'aca-backend-pool-web-api-429-prioritized')\n",
75+
"aca_backend_pool_prioritized_and_weighted_policy_xml = utils.read_policy_xml(base_policy).format(retry_count = 2, backend_id = 'aca-backend-pool-web-api-429-prioritized-and-weighted')\n",
76+
"aca_backend_pool_weighted_equal_policy_xml = utils.read_policy_xml(base_policy).format(retry_count = 1, backend_id = 'aca-backend-pool-web-api-429-weighted-50-50')\n",
77+
"aca_backend_pool_weighted_unequal_policy_xml = utils.read_policy_xml(base_policy).format(retry_count = 1, backend_id = 'aca-backend-pool-web-api-429-weighted-80-20')\n",
7878
"\n",
7979
"# Standard GET Operation\n",
8080
"get = GET_APIOperation('This is a standard GET')\n",

0 commit comments

Comments
 (0)