Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding retry context properties to InvocationRequest
- Loading branch information
Showing
8 changed files
with
127 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
var invocationCount = 0; | ||
var errorString = 'An error occurred'; | ||
|
||
module.exports = async function (context, req) { | ||
const reset = req.query.reset; | ||
invocationCount = reset ? 0 : invocationCount | ||
if (context.executionContext.retryContext && (context.executionContext.retryContext.retryCount !== invocationCount | ||
|| !(context.executionContext.retryContext.maxRetryCount === 4 || context.executionContext.retryContext.maxRetryCount === 0) | ||
|| !(context.executionContext.retryContext.exception.message.includes(errorString)))) { | ||
context.res = { | ||
status: 500 | ||
}; | ||
} else { | ||
const reset = req.query.reset; | ||
invocationCount = reset ? 0 : invocationCount | ||
|
||
context.log('JavaScript HTTP trigger function processed a request.invocationCount: ' + invocationCount); | ||
context.log('JavaScript HTTP trigger function processed a request.invocationCount: ' + invocationCount); | ||
|
||
invocationCount = invocationCount + 1; | ||
const responseMessage = "invocationCount: " + invocationCount; | ||
if (invocationCount < 4) { | ||
throw new Error('An error occurred'); | ||
invocationCount = invocationCount + 1; | ||
const responseMessage = "invocationCount: " + invocationCount; | ||
if (invocationCount < 4) { | ||
throw new Error(errorString); | ||
} | ||
context.res = { | ||
// status: 200, /* Defaults to 200 */ | ||
body: responseMessage | ||
}; | ||
} | ||
context.res = { | ||
// status: 200, /* Defaults to 200 */ | ||
body: responseMessage | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,28 @@ | ||
var invocationCount = 0; | ||
var errorString = 'An error occurred'; | ||
|
||
module.exports = async function (context, req) { | ||
const reset = req.query.reset; | ||
invocationCount = reset ? 0 : invocationCount | ||
if (context.executionContext.retryContext && (context.executionContext.retryContext.retryCount !== invocationCount | ||
|| !(context.executionContext.retryContext.maxRetryCount === 2 || context.executionContext.retryContext.maxRetryCount === 0) | ||
|| !(context.executionContext.retryContext.exception.message.includes(errorString)))) { | ||
debugger; | ||
context.res = { | ||
status: 500 | ||
}; | ||
} else { | ||
const reset = req.query.reset; | ||
invocationCount = reset ? 0 : invocationCount | ||
|
||
context.log('JavaScript HTTP trigger function processed a request.invocationCount: ' + invocationCount); | ||
|
||
invocationCount = invocationCount + 1; | ||
const responseMessage = "invocationCount: " + invocationCount; | ||
if (invocationCount < 2) { | ||
throw new Error('An error occurred'); | ||
context.log('JavaScript HTTP trigger function processed a request.invocationCount: ' + invocationCount); | ||
|
||
invocationCount = invocationCount + 1; | ||
const responseMessage = "invocationCount: " + invocationCount; | ||
if (invocationCount < 2) { | ||
throw new Error('An error occurred'); | ||
} | ||
context.res = { | ||
// status: 200, /* Defaults to 200 */ | ||
body: responseMessage | ||
}; | ||
} | ||
context.res = { | ||
// status: 200, /* Defaults to 200 */ | ||
body: responseMessage | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters