Class: MicroServiceClient::MicroserviceServerInstallJob
- Inherits:
-
ActiveJob::Base
- Object
- ActiveJob::Base
- MicroServiceClient::MicroserviceServerInstallJob
- Defined in:
- app/jobs/micro_service_client/microservice_server_install_job.rb
Instance Method Summary collapse
Instance Method Details
#perform(*args) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/jobs/micro_service_client/microservice_server_install_job.rb', line 5 def perform(*args) params = args. begin MicroService::Server.new(params).save # Failed to notify the microservice we successfully installed ourselves rescue MicroService::Server::InstallError => $e # Increment attempt number params["attempt"] ||= 1 params["attempt"] = params["attempt"] + 1 # Try again in one minute MicroserviceServerInstallJob.set(wait: 1.minute).perform_later(params) unless params["attempt"].to_i > 3 end end |