Skip to content

Commit

Permalink
fix: Don't rethrow deserialization exceptions from FusionCache (#1535)
Browse files Browse the repository at this point in the history
## Description

This causes any deserialization exceptions happening when fetching
caches to trigger a factory run, instead of bubbling up and hitting the
global exception handler.

This error was introduced in #1409, which added a non-nullable field to
an entity that existed in the distributed cache.

## Related Issue(s)

- #1409 

## Verification

- [x] **Your** code builds clean without any errors or warnings
- [x] Manual testing done (required)
- [ ] Relevant automated test added (if you find this hard, leave it and
we'll help out)

## Documentation

- [ ] Documentation is updated (either in `docs`-directory, Altinnpedia
or a separate linked PR in
[altinn-studio-docs.](https://github.com/Altinn/altinn-studio-docs), if
applicable)
  • Loading branch information
elsand authored Nov 26, 2024
1 parent f082096 commit 790feb8
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,12 @@ private static IServiceCollection ConfigureFusionCache(this IServiceCollection s
JitterMaxDuration = settings.JitterMaxDuration,
EagerRefreshThreshold = settings.EagerRefreshThreshold,

SkipMemoryCache = settings.SkipMemoryCache
SkipMemoryCache = settings.SkipMemoryCache,

// This will stop deserialization exceptions to be re-thrown, which will cause the factory to run as if
// the cache entry was not found. This avoids crashes which otherwise would happen if entities that
// are cached are changed in a way that makes them incompatible with the cached version.
ReThrowSerializationExceptions = false
})
.WithRegisteredSerializer()
// If Redis is disabled (eg. in local development or non-web runtimes), we must instruct FusionCache to
Expand Down

0 comments on commit 790feb8

Please sign in to comment.