A lua workaround to keep the distsrv from falling over

Discussion created by jesse.gonzalez on Mar 20, 2010
Latest reply on Mar 24, 2010 by david.pippenger
I've had repeated issues with the deployment of hundreds of packages using the Distribution Server. The target distsrv, and the master distsrv forwarding requests would get stuck, and would no longer process requests. So I wrote this. Sleeping for 5 seconds keeps the distsrv from getting overwhelmed.

I have an environment where I can define a regex for device type which is captured in the robot name. Modify for your needs.

master = "/Your/Master/Hub"
hubs = nimbus.request(master, "gethubs")

robotname_regex = ".*hubregex.*/robotnameregex.*"
requestpds = pds.create()
pds.putString(requestpds, "package", "some_package_to_distribute")

for hubindex,hub in pairs(hubs.hublist) do
  robots = nimbus.request(hub.addr, "getrobots")
  for robotindex,robot in pairs(robots.robotlist) do
    if string.match(robot.addr, robotname_regex) ~= nil then
      ret, rc = nimbus.request(robot.addr, "inst_request", requestpds)
      if (rc == nil or rc ~= 0) then
        print ("There was an error with inst_request")

pds.delete (requestpds)