macadmins / installapplications

A tool for dynamically using installapplication
Apache License 2.0
286 stars 62 forks source link

Add configuration for item retries and wait intervals #106

Closed danhutchings closed 1 year ago

danhutchings commented 1 year ago

InstallApplications (IAs) has a hardcoded download retry limit of 3 retries. This prevents an adminitrator from defining or having control over the number of times an item is attempted to download. This PR gives an administrator the option to define the number of retries, and the number of seconds to wait in between retries. If the item is missing the retries or retrywait values, then IAs will default to 3 retries, with a retry wait time of 5 seconds between retries.

Outside of this PR, something I noticed was that the hardcoded retries was happening very rapidly (~100ths of seconds). This is because the while block starting on L355 doesn't have some kind of time.sleep() invocation to delay the retry attempts. This led to items failing very fast. The use case I am using IAs is with Mac laptops, that can take several seconds to join WiFi or otherwise get network functioning. So, when userland items begin to take off, and the Mac is still trying to get full functioning WiFi, IAs basically gives up since the retry failures are so quick.

I'm hoping this PR, if merged, gives administrators the ability to improve IAs item success.

erikng commented 1 year ago

I'll merge but can you update the readme or wiki so I can see what the new json looks like? Want to ensure people can quickly update this.

erikng commented 1 year ago

Now that I see how it works, I'm going to ask that you add it to generatejson.py script so people can easily have this set without manually creating their jsons.

danhutchings commented 1 year ago

hey @erikng! I added the updates you requested (maybe more). Let me know what you think. Thanks!