Removed CachedRequest functionality + Fixed(Tested) PursuitSequence bug
This commit is contained in:
@ -26,7 +26,6 @@ enum class EDTFluxRequestState : uint8
|
||||
Completed UMETA(DisplayName = "Completed"),
|
||||
Failed UMETA(DisplayName = "Failed"),
|
||||
TimedOut UMETA(DisplayName = "TimedOut"),
|
||||
Cached UMETA(DisplayName = "Cached"),
|
||||
Retrying UMETA(DisplayName = "Retrying")
|
||||
};
|
||||
|
||||
@ -43,12 +42,6 @@ struct DTFLUXNETWORK_API FDTFluxRequestConfig
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
float RetryBackoffMultiplier = 1.5f;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
bool bEnableCache = true;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
float CacheValiditySeconds = 60.0f;
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
@ -112,10 +105,8 @@ struct DTFLUXNETWORK_API FDTFluxTrackedRequest
|
||||
|
||||
bool HasTimedOut() const;
|
||||
bool CanRetry() const;
|
||||
bool IsCacheValid() const;
|
||||
float GetRetryDelay() const;
|
||||
bool Matches(EDTFluxApiDataType InType, int32 InContestId = -1, int32 InStageId = -1, int32 InSplitId = -1) const;
|
||||
FString GetCacheKey() const;
|
||||
void SetRawResponse(const FString& RawData);
|
||||
FString Serialize() const;
|
||||
};
|
||||
@ -137,7 +128,7 @@ DECLARE_MULTICAST_DELEGATE_OneParam(FOnRequestFailedNative, const FDTFluxTracked
|
||||
// ================================================================================================
|
||||
|
||||
/**
|
||||
* Gestionnaire de requêtes trackées avec cache, timeout, retry et parsing asynchrone
|
||||
* Gestionnaire de requêtes trackées timeout, retry et parsing asynchrone
|
||||
* Implémentation C++ pure avec SmartPointers pour des performances optimales
|
||||
*/
|
||||
class DTFLUXNETWORK_API FDTFluxQueuedRequestManager : public FTickableGameObject
|
||||
@ -229,7 +220,7 @@ public:
|
||||
*/
|
||||
bool RetryRequest(const FGuid& RequestId);
|
||||
|
||||
// === RECHERCHE ET CACHE ===
|
||||
// === RECHERCHE ===
|
||||
|
||||
/**
|
||||
* Chercher une requête en attente correspondant aux critères
|
||||
@ -242,28 +233,6 @@ public:
|
||||
int32 SplitId = -1
|
||||
) const;
|
||||
|
||||
/**
|
||||
* Récupérer une réponse depuis le cache (données brutes)
|
||||
*/
|
||||
bool GetFromCache(
|
||||
EDTFluxApiDataType RequestType,
|
||||
FString& OutRawResponse,
|
||||
int32 ContestId = -1,
|
||||
int32 StageId = -1,
|
||||
int32 SplitId = -1
|
||||
) const;
|
||||
|
||||
/**
|
||||
* Récupérer une réponse parsée depuis le cache
|
||||
*/
|
||||
bool GetParsedFromCache(
|
||||
EDTFluxApiDataType RequestType,
|
||||
TSharedPtr<FDTFluxServerResponse>& OutResponse,
|
||||
int32 ContestId = -1,
|
||||
int32 StageId = -1,
|
||||
int32 SplitId = -1
|
||||
) const;
|
||||
|
||||
// === ACCESSEURS ===
|
||||
|
||||
/**
|
||||
@ -294,25 +263,15 @@ public:
|
||||
struct FRequestStatistics
|
||||
{
|
||||
int32 Pending = 0;
|
||||
int32 Cached = 0;
|
||||
int32 Completed = 0;
|
||||
int32 Failed = 0;
|
||||
int32 TotalRequests = 0;
|
||||
int32 CacheHits = 0;
|
||||
int32 CacheMisses = 0;
|
||||
float HitRate = 0.0f;
|
||||
};
|
||||
|
||||
FRequestStatistics GetStatistics() const;
|
||||
|
||||
// === NETTOYAGE ===
|
||||
|
||||
/**
|
||||
* Nettoyer les entrées de cache expirées
|
||||
* @return Nombre d'entrées supprimées
|
||||
*/
|
||||
int32 CleanupExpiredCache();
|
||||
|
||||
/**
|
||||
* Nettoyer les requêtes terminées anciennes
|
||||
* @param OlderThanSeconds Supprimer les requêtes plus anciennes que ce délai
|
||||
@ -321,7 +280,7 @@ public:
|
||||
int32 CleanupCompletedRequests(float OlderThanSeconds = 300.0f);
|
||||
|
||||
/**
|
||||
* Vider toutes les requêtes et le cache
|
||||
* Vider toutes les requêtes
|
||||
*/
|
||||
void ClearAllRequests();
|
||||
|
||||
@ -353,17 +312,14 @@ private:
|
||||
|
||||
// === TIMING POUR LE TICK ===
|
||||
float TimeSinceLastTimeoutCheck = 0.0f;
|
||||
float TimeSinceLastCacheCleanup = 0.0f;
|
||||
float TimeSinceLastRetryCheck = 0.0f;
|
||||
|
||||
static constexpr float TimeoutCheckInterval = 1.0f;
|
||||
static constexpr float CacheCleanupInterval = 30.0f;
|
||||
static constexpr float RetryCheckInterval = 0.5f;
|
||||
|
||||
// === STOCKAGE THREAD-SAFE ===
|
||||
mutable FCriticalSection RequestsLock;
|
||||
TMap<FGuid, TSharedPtr<FDTFluxTrackedRequest>> AllRequests;
|
||||
TMap<FString, FGuid> CacheKeyToRequestId;
|
||||
|
||||
// === CALLBACKS C++ ===
|
||||
mutable FCriticalSection CallbacksLock;
|
||||
@ -373,8 +329,6 @@ private:
|
||||
// === MÉTRIQUES ===
|
||||
mutable FCriticalSection MetricsLock;
|
||||
mutable int32 TotalRequests = 0;
|
||||
mutable int32 CacheHits = 0;
|
||||
mutable int32 CacheMisses = 0;
|
||||
|
||||
|
||||
// === PARSER ASYNCHRONE ===
|
||||
@ -397,11 +351,6 @@ private:
|
||||
*/
|
||||
void ProcessRetries();
|
||||
|
||||
/**
|
||||
* Nettoyer le cache périodiquement
|
||||
*/
|
||||
void ProcessCacheCleanup();
|
||||
|
||||
/**
|
||||
* Déclencher les callbacks pour une requête
|
||||
*/
|
||||
@ -412,17 +361,6 @@ private:
|
||||
*/
|
||||
void CleanupCallbacks(const FGuid& RequestId);
|
||||
|
||||
/**
|
||||
* Enregistrer un hit cache dans les métriques
|
||||
*/
|
||||
void RecordCacheHit() const;
|
||||
|
||||
/**
|
||||
* Enregistrer un miss cache dans les métriques
|
||||
*/
|
||||
void RecordCacheMiss() const;
|
||||
|
||||
|
||||
// === CALLBACKS POUR LE PARSING ASYNCHRONE ===
|
||||
|
||||
/**
|
||||
@ -434,11 +372,4 @@ private:
|
||||
* Callback appelé quand le parsing asynchrone échoue
|
||||
*/
|
||||
void OnParsingFailed(const FGuid& RequestId, const FString& ErrorMessage);
|
||||
|
||||
// === UTILITAIRES STATIQUES ===
|
||||
|
||||
/**
|
||||
* Générer une clé de cache unique pour une requête
|
||||
*/
|
||||
static FString GenerateCacheKey(EDTFluxApiDataType RequestType, int32 ContestId, int32 StageId, int32 SplitId);
|
||||
};
|
||||
|
||||
@ -125,8 +125,7 @@ public:
|
||||
FOnDTFluxRequestSuccess& OnSuccess,
|
||||
FOnDTFluxRequestError& OnError,
|
||||
float TimeoutSeconds = 5.0f,
|
||||
int32 MaxRetries = 3,
|
||||
bool bEnableCache = true
|
||||
int32 MaxRetries = 3
|
||||
);
|
||||
|
||||
// === ACCESSEURS BLUEPRINT POUR LES REQUÊTES TRACKÉES ===
|
||||
@ -166,8 +165,7 @@ public:
|
||||
* Récupérer les statistiques du gestionnaire de requêtes
|
||||
*/
|
||||
UFUNCTION(BlueprintCallable, Category = "DTFlux|Tracked Requests")
|
||||
void GetRequestStatistics(int32& OutPending, int32& OutCached, int32& OutCompleted, int32& OutFailed,
|
||||
float& OutHitRate) const;
|
||||
void GetRequestStatistics(int32& OutPending, int32& OutCompleted, int32& OutFailed) const;
|
||||
|
||||
// === REQUÊTES LEGACY (Compatibilité totale) ===
|
||||
|
||||
@ -249,7 +247,7 @@ private:
|
||||
|
||||
// === GESTION DES ÉVÉNEMENTS WEBSOCKET ===
|
||||
void RegisterWebSocketEvents();
|
||||
void UnregisterWebSocketEvents();
|
||||
void UnregisterWebSocketEvents() const;
|
||||
void OnWebSocketConnected_Subsystem();
|
||||
void OnWebSocketConnectionError_Subsystem(const FString& Error);
|
||||
void OnWebSocketClosedEvent_Subsystem(int32 StatusCode, const FString& Reason, bool bWasClean);
|
||||
|
||||
Reference in New Issue
Block a user