Skip to content

Commit

Permalink
ROYAL-1834 Update ActionPolicy for REST requests to handle all except…
Browse files Browse the repository at this point in the history
…ions (#33)
  • Loading branch information
SShumer authored Jul 30, 2021
1 parent 93e3edf commit 7850dc6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/Global/GlobalAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@

// 2.9.0.0 - magento 2 supported, 9 build, 0 subversion (includes significant features and codechanges)

[ assembly : AssemblyVersion( "2.18.4.0" ) ]
[ assembly : AssemblyVersion( "2.18.5.0" ) ]
23 changes: 1 addition & 22 deletions src/MagentoAccess/Services/Rest/v2x/Repository/ActionPolicies.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using MagentoAccess.Misc;
using Netco.ActionPolicyServices;
Expand All @@ -9,26 +7,7 @@ namespace MagentoAccess.Services.Rest.v2x.Repository
{
internal static class ActionPolicies
{
public static ActionPolicyAsync RepeatOnChannelProblemAsync { get; } = ActionPolicyAsync.From( ( exception =>
{
var magentoWebException = exception as MagentoWebException;
if ( magentoWebException != null
&& magentoWebException.StatusCode != null )
{
switch( magentoWebException.StatusCode )
{
case HttpStatusCode.NotFound:
case HttpStatusCode.BadRequest:
case HttpStatusCode.ServiceUnavailable:
case HttpStatusCode.BadGateway:
return true;
default:
return false;
}
}

return false;
} ) )
public static ActionPolicyAsync RepeatOnChannelProblemAsync { get; } = ActionPolicyAsync.Handle< Exception >()
.RetryAsync( 7, async ( ex, i ) =>
{
MagentoLogger.Log().Trace( ex, "Retrying Magento API call due to channel problem for the {0} time", i );
Expand Down

0 comments on commit 7850dc6

Please sign in to comment.