Skip to content

Commit 6b95141

Browse files
authored
Moving to SDK 3.0.28 packages (#7283)
1 parent 2f226ac commit 6b95141

File tree

7 files changed

+25
-37
lines changed

7 files changed

+25
-37
lines changed
Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,21 @@
1-
var invocationCount = 0;
2-
var errorString = 'An error occurred';
1+
var errorString = 'An error occurred';
2+
var maxRetries = 4;
33

44
module.exports = async function (context, req) {
5-
if (context.executionContext.retryContext && (context.executionContext.retryContext.retryCount !== invocationCount
6-
|| !(context.executionContext.retryContext.maxRetryCount === 4 || context.executionContext.retryContext.maxRetryCount === 0)
7-
|| !(context.executionContext.retryContext.exception.message.includes(errorString)))) {
5+
var retryContext = context.executionContext.retryContext;
6+
7+
if (retryContext.maxRetryCount != maxRetries || (retryContext.retryCount > 0 && !retryContext.exception.message.includes(errorString))) {
88
context.res = {
99
status: 500
1010
};
1111
} else {
12-
const reset = req.query.reset;
13-
invocationCount = reset ? 0 : invocationCount
14-
15-
context.log('JavaScript HTTP trigger function processed a request.invocationCount: ' + invocationCount);
12+
context.log('JavaScript HTTP trigger function processed a request. retryCount: ' + retryContext.retryCount);
1613

17-
invocationCount = invocationCount + 1;
18-
const responseMessage = "invocationCount: " + invocationCount;
19-
if (invocationCount < 4) {
14+
if (retryContext.retryCount < maxRetries) {
2015
throw new Error(errorString);
2116
}
2217
context.res = {
23-
// status: 200, /* Defaults to 200 */
24-
body: responseMessage
18+
body: 'retryCount: ' + retryContext.retryCount
2519
};
2620
}
2721
}
Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,22 @@
1-
var invocationCount = 0;
2-
var errorString = 'An error occurred';
1+
var errorString = 'An error occurred';
2+
var maxRetries = 2;
33

44
module.exports = async function (context, req) {
5-
if (context.executionContext.retryContext && (context.executionContext.retryContext.retryCount !== invocationCount
6-
|| !(context.executionContext.retryContext.maxRetryCount === 2 || context.executionContext.retryContext.maxRetryCount === 0)
7-
|| !(context.executionContext.retryContext.exception.message.includes(errorString)))) {
5+
var retryContext = context.executionContext.retryContext;
6+
7+
if (retryContext.maxRetryCount != maxRetries || (retryContext.retryCount > 0 && !retryContext.exception.message.includes(errorString))) {
88
debugger;
99
context.res = {
1010
status: 500
1111
};
1212
} else {
13-
const reset = req.query.reset;
14-
invocationCount = reset ? 0 : invocationCount
15-
16-
context.log('JavaScript HTTP trigger function processed a request.invocationCount: ' + invocationCount);
13+
context.log('JavaScript HTTP trigger function processed a request. retryCount: ' + retryContext.retryCount);
1714

18-
invocationCount = invocationCount + 1;
19-
const responseMessage = "invocationCount: " + invocationCount;
20-
if (invocationCount < 2) {
21-
throw new Error('An error occurred');
15+
if (retryContext.retryCount < maxRetries) {
16+
throw new Error(errorString);
2217
}
2318
context.res = {
24-
// status: 200, /* Defaults to 200 */
25-
body: responseMessage
19+
body: 'retryCount: ' + retryContext.retryCount
2620
};
2721
}
2822
}

src/WebJobs.Script.WebHost/WebJobs.Script.WebHost.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
<PackageReference Include="Microsoft.Azure.AppService.Proxy.Client" Version="2.0.11020001-fabe022e" />
6868
<PackageReference Include="Microsoft.Azure.Services.AppAuthentication" Version="1.0.3" />
6969
<PackageReference Include="Microsoft.Azure.Storage.File" Version="11.1.7" />
70-
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.27" />
71-
<PackageReference Include="Microsoft.Azure.WebJobs.Host.Storage" Version="4.0.1" />
70+
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.28" />
71+
<PackageReference Include="Microsoft.Azure.WebJobs.Host.Storage" Version="4.0.2" />
7272
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.3" />
7373
<PackageReference Include="Microsoft.Azure.WebJobs.Logging" Version="4.0.2" />
7474
<PackageReference Include="Microsoft.Azure.WebSites.DataProtection" Version="2.1.91-alpha" />

src/WebJobs.Script/WebJobs.Script.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444
<PackageReference Include="Microsoft.Azure.Functions.NodeJsWorker" Version="2.1.1" />
4545
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS6" Version="3.0.630" />
4646
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7" Version="3.0.738" />
47-
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.27" />
47+
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.28" />
4848
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="4.0.3" />
4949
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="3.1.0" />
50-
<PackageReference Include="Microsoft.Azure.WebJobs.Logging.ApplicationInsights" Version="3.0.27" />
50+
<PackageReference Include="Microsoft.Azure.WebJobs.Logging.ApplicationInsights" Version="3.0.28" />
5151
<PackageReference Include="Microsoft.Azure.WebJobs.Script.Abstractions" Version="1.0.2-preview" />
5252
<PackageReference Include="Microsoft.Build" Version="15.8.166" />
5353
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="3.3.1" />

test/WebJobs.Script.Tests.Integration/WebHostEndToEnd/SamplesEndToEndTests_Node_Retry.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public async Task HttpTrigger_RetryFunctionJson_Get_Succeeds()
3232
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
3333
string body = await response.Content.ReadAsStringAsync();
3434
Assert.Equal("text/plain", response.Content.Headers.ContentType.MediaType);
35-
Assert.Equal("invocationCount: 4", body);
35+
Assert.Equal("retryCount: 4", body);
3636
}
3737

3838
[Fact]
@@ -42,7 +42,7 @@ public async Task HttpTrigger_RetryHostJson_Get_Succeeds()
4242
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
4343
string body = await response.Content.ReadAsStringAsync();
4444
Assert.Equal("text/plain", response.Content.Headers.ContentType.MediaType);
45-
Assert.Equal("invocationCount: 2", body);
45+
Assert.Equal("retryCount: 2", body);
4646
}
4747

4848
public class TestFixture : EndToEndTestFixture

test/WebJobs.Script.Tests.Integration/WebJobs.Script.Tests.Integration.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<PackageReference Include="Microsoft.Azure.DocumentDB.Core" Version="2.10.0" />
4040
<PackageReference Include="Microsoft.Azure.EventHubs" Version="2.1.0" />
4141
<PackageReference Include="Microsoft.Azure.Functions.NodeJsWorker" Version="2.1.1" />
42-
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="4.0.3" />
42+
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="4.0.4" />
4343
<PackageReference Include="Microsoft.Azure.Functions.JavaWorker" Version="1.8.2-SNAPSHOT" />
4444
<PackageReference Include="Microsoft.Azure.Mobile.Client" Version="4.0.2" />
4545
<PackageReference Include="Microsoft.Azure.ServiceBus" Version="3.1.0" />

test/WebJobs.Script.Tests/WebJobs.Script.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
5656
<PackageReference Include="Moq" Version="4.9.0" />
5757
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta004" />
58-
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="4.0.3" />
58+
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="4.0.4" />
5959
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="2.1.0.227">
6060
</PackageReference>
6161
<PackageReference Include="xunit" Version="2.4.0" />

0 commit comments

Comments
 (0)