Retry cached path executions with full graph

This commit is contained in:
Chris Roberts 2022-04-07 09:17:27 -07:00 committed by Paul Hinze
parent f3a3bb83fd
commit 305fddb49a
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0

View File

@ -58,6 +58,16 @@ module VagrantPlugins
end
end
# Remove an existing path registration
#
# @param src [Class] source type
# @param dst [Class] destination type
# @return [NilClass]
def unregister(src, dst)
@previous.delete(generate_key(src, dst))
nil
end
# Fetch a path for a given source and destination
# if it has been registered
#
@ -170,6 +180,22 @@ module VagrantPlugins
# The resultant value will be stored within the
# destination vertex
@dst.value
rescue => err
# If a failure was encountered and the graph was fresh
# allow the error to continue bubbling up
raise if fresh
# If the graph is not fresh, unregister the cached path
# and retry the mapping with the full graph
logger.trace("search execution using cached path failed, retrying with full graph (#{err})")
self.class.unregister(source, final)
self.class.new(
output_type: final,
input_values: inputs,
mappers: mappers,
named: named,
source: source
).execute
end
def to_s