Class: MicroServiceServer::MicroserviceClientInstallJob
- Inherits:
-
ActiveJob::Base
- Object
- ActiveJob::Base
- MicroServiceServer::MicroserviceClientInstallJob
- Defined in:
- app/jobs/micro_service_server/microservice_client_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_server/microservice_client_install_job.rb', line 5 def perform(*args) params = args. begin MicroService::Client.new(params).save # Failed to notify the microservice we successfully installed ourselves rescue MicroService::Client::InstallError => $e # Increment attempt number params["attempt"] ||= 1 params["attempt"] = params["attempt"] + 1 # Try again in one minute MicroserviceClientInstallJob.set(wait: 1.minute).perform_later(params) unless params["attempt"].to_i > 3 end end |