IO-1162 Retry query on JWT expiration
This commit is contained in:
@@ -22,7 +22,7 @@ namespace BodyshopPartner.Utils
|
|||||||
return graphQLClient;
|
return graphQLClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<dynamic> ExecuteQuery(GraphQLRequest r)
|
public static async Task<dynamic> ExecuteQuery(GraphQLRequest r, bool lastTry = false)
|
||||||
{
|
{
|
||||||
using (var g = Utils.GraphQL.CreateGQLClient())
|
using (var g = Utils.GraphQL.CreateGQLClient())
|
||||||
{
|
{
|
||||||
@@ -49,9 +49,15 @@ namespace BodyshopPartner.Utils
|
|||||||
};
|
};
|
||||||
exceptionString = exceptionString + x + ";";
|
exceptionString = exceptionString + x + ";";
|
||||||
});
|
});
|
||||||
if (jwtExpired) await Utils.Auth.Refresh(); ;
|
if (jwtExpired && !lastTry) { await Utils.Auth.Refresh();
|
||||||
logger.Error("---------------------");
|
return (ExecuteQuery(r, true));
|
||||||
throw new Exception(exceptionString);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger.Error("---------------------");
|
||||||
|
throw new Exception(exceptionString);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user