Skip to content

Commit

Permalink
chore: minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
naqvis committed Nov 26, 2024
1 parent f42d7a4 commit c79a057
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/placeos-rest-api/controllers/drivers.cr
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ module PlaceOS::Api

def self.driver_reload(driver : ::PlaceOS::Model::Driver, request_id : String) : Tuple(Int32, String)
cores = RemoteDriver.default_discovery.node_hash
wg = WaitGroup.new(cores.size)
wg = WaitGroup.new
channel = Channel(Tuple(Int32, String)).new(cores.size)
cores.each do |core_id, uri|
spawn do
wg.spawn do
client = PlaceOS::Core::Client.new(uri: uri, request_id: request_id)
resp = client.driver_reload(driver.id.as(String))
channel.send(resp)
Expand All @@ -148,8 +148,6 @@ module PlaceOS::Api
request_id: request_id,
} }
channel.send({500, "failed to request a driver reload on core #{uri}: error: #{error.message}"})
ensure
wg.done
end
end

Expand Down

0 comments on commit c79a057

Please sign in to comment.