https://bugzilla.redhat.com/show_bug.cgi?id=696228
This adds a temporary fix to cover the race condition seen in testing when a status update comes back before the build request from conductor has completed and update the uuid in conductor db. --- .../factory_rest_handler.rb | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/services/image_factory/image_factory_connector/lib/image_factory_connector/factory_rest_handler.rb b/services/image_factory/image_factory_connector/lib/image_factory_connector/factory_rest_handler.rb index 35e1366..2a0cead 100644 --- a/services/image_factory/image_factory_connector/lib/image_factory_connector/factory_rest_handler.rb +++ b/services/image_factory/image_factory_connector/lib/image_factory_connector/factory_rest_handler.rb @@ -50,6 +50,13 @@ class FactoryRestHandler < BaseHandler :headers => {:Accepts => "application/xml"}, :params => {:uuid => e.uuid, :status => e.value}) hydra.queue(request) + # FIXME: this is a temporary hack to get around the case where + # updates are triggered before the initial request from conductor + # has completed, which can happen because this is all asynchronous. + # Once status is stored in warehouse rather than conductor, this + # will not be an issue, so it is not worth doing something more + # elegant right now. + sleep(5) request.on_complete do |response| # 3. Log errors logger.debug "Return code is: #{response.code}"