Skip to content

Commit 5185bd5

Browse files
committed
retry after deserialization failure
1 parent df5a908 commit 5185bd5

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/DynamicObjects.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,15 @@ _computeproperty(o, name, indices...; __status__=nothing, kwargs...) = begin
481481
mkpath(dirname(cache_path))
482482
cache_status = get_cache_status(cache_path)
483483
rv = if cache_status == :ready
484-
Serialization.deserialize(cache_path)
484+
try
485+
Serialization.deserialize(cache_path)
486+
catch e
487+
@warn "Deserialization failed for $cache_path, recomputing." exception=e
488+
rm(cache_path; force=true)
489+
cache_status = :unstarted
490+
touch(cache_path)
491+
nothing
492+
end
485493
else
486494
cache_status == :started && @warn "Cache file $cache_path exists but has size 0.\nAssuming a previous run failed."
487495
touch(cache_path)

0 commit comments

Comments
 (0)