forked from loafle/openapi-generator-original
[cpp-ue4] Added UE4.26 support, (#8964)
* [cpp-ue4] Fixed enum values not being quoted. I'm not sure when this started breaking. * [cpp-ue4] UE 4.26 Compatibility: Replaced TSharedRef<IHttpRequest by FHttpRequestRef for better portability * [cpp-ue4] Improved DateTime parsing * [cpp-ue4] Made HttpFileInput constructors explicit * [cpp-ue4] Added the possibility to retry requests easily with AsyncRetry method on the response and SetAutoRetryCount on the request WIP auto retry [cpp-ue4] Adds support for instant retry * [cpp-ue4] Using TaskGraph instead of TaskGraphMainThread for async retries * update samples * remove trailing spaces Co-authored-by: Jean-Noel Gourdol <jngourdol@stormancer.com> Co-authored-by: William Cheng <wing328hk@gmail.com>
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
|
||||
#include "OpenAPIBaseModel.h"
|
||||
|
||||
#include "Async/Async.h"
|
||||
|
||||
namespace OpenAPI
|
||||
{
|
||||
|
||||
@@ -25,4 +27,13 @@ void Response::SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode)
|
||||
}
|
||||
}
|
||||
|
||||
void Response::AsyncRetry() const
|
||||
{
|
||||
// Unfortunately, it is currently usafe to call ProcessRequest() directly here.
|
||||
// This is because the HttpManager will remove all references to this HttpRequest in FHttpManager::Tick including the new request we just added, instead of removing just one.
|
||||
// This will lead to the request's destruction and eventually a crash.
|
||||
// The only solution is therefore to ensure we are taking an extra reference to the request, and that the request is added after the queue is flushed.
|
||||
Async(EAsyncExecution::TaskGraph, [AddRef = FHttpRequestPtr(GetHttpRequest())](){ AddRef->ProcessRequest(); });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user