diff options
4 files changed, 22 insertions, 12 deletions
diff --git a/Module.Taskfile.yaml b/Module.Taskfile.yaml index d729ea3..f5af56c 100644 --- a/Module.Taskfile.yaml +++ b/Module.Taskfile.yaml @@ -23,14 +23,13 @@ tasks: - git remote update - git reset --hard - git pull origin {{.BRANCH_NAME}} --verify-signatures + #re-write semver after hard reset so build still works properly + - dotnet-gitversion.exe /updateprojectfiles #called by build pipeline to build module build: cmds: - echo "building module {{.MODULE_NAME}}" - - #re-write semver after hard reset, before build - - dotnet-gitversion.exe /updateprojectfiles #build debug mode first - task: build_debug diff --git a/lib/VNLib.Plugins.Extensions.VNCache/src/RemoteBackedMemoryCache.cs b/lib/VNLib.Plugins.Extensions.VNCache/src/RemoteBackedMemoryCache.cs index ff73f19..0e92c22 100644 --- a/lib/VNLib.Plugins.Extensions.VNCache/src/RemoteBackedMemoryCache.cs +++ b/lib/VNLib.Plugins.Extensions.VNCache/src/RemoteBackedMemoryCache.cs @@ -198,8 +198,22 @@ namespace VNLib.Plugins.Extensions.VNCache //Serialze the value serialzer.Serialize(value, buffer); - //Call update on raw data - await AddOrUpdateAsync(key, newKey, buffer, cancellation); + DateTime currentTime = DateTime.UtcNow; + + try + { + //Update remote first, and if exceptions are raised, do not update local cache + await Client.AddOrUpdateObjectAsync(key, newKey, (IObjectData)buffer, cancellation); + + //Safe to update local cache + await _memCache.AddOrUpdateObjectAsync(key, newKey, static b => b.GetData(), buffer, currentTime, CancellationToken.None); + } + catch + { + //Remove local cache if exception occurs + await _memCache.DeleteObjectAsync(key, CancellationToken.None); + throw; + } } ///<inheritdoc/> diff --git a/lib/VNLib.Plugins.Extensions.VNCache/src/VnCacheClient.cs b/lib/VNLib.Plugins.Extensions.VNCache/src/VnCacheClient.cs index 72eecd8..df7008d 100644 --- a/lib/VNLib.Plugins.Extensions.VNCache/src/VnCacheClient.cs +++ b/lib/VNLib.Plugins.Extensions.VNCache/src/VnCacheClient.cs @@ -189,17 +189,18 @@ namespace VNLib.Plugins.Extensions.VNCache pluginLog.Debug("Cache server disconnected"); } + catch(TimeoutException) + { + pluginLog.Warn("Failed to establish a websocket connection to cache server"); + } catch (WebSocketException wse) { pluginLog.Warn("Failed to establish a websocket connection to cache server {reason}", wse.Message); - continue; } //SEs may be raised when the server is not available catch (HttpRequestException he) when (he.InnerException is SocketException) { pluginLog.Debug("Failed to connect to random cache server because a TCP connection could not be established"); - //Continue next loop - continue; } finally { diff --git a/plugins/ObjectCacheServer/src/Cache/CacheConfiguration.cs b/plugins/ObjectCacheServer/src/Cache/CacheConfiguration.cs index 86e1f5a..bd15d24 100644 --- a/plugins/ObjectCacheServer/src/Cache/CacheConfiguration.cs +++ b/plugins/ObjectCacheServer/src/Cache/CacheConfiguration.cs @@ -44,10 +44,6 @@ namespace VNLib.Data.Caching.ObjectCache.Server.Cache public int MaxMessageSize { get; set; } = 1000 * 1024; - [JsonPropertyName("change_queue_max_depth")] - public int MaxEventQueueDepth { get; set; } = 10 * 1000; - - [JsonPropertyName("max_cache")] public uint MaxCacheEntries { get; set; } = 10000; |