I disagree. The root issue is your scripts performing network-dependent operations in a context where low-latency is not optional. This blocking operation in a tag event is the root cause. Any future disruption to the network breaks your whole gateway.
Use of writeAsync()
is a good solution, but not by itself. You will need to save state (in a memory tag, typically) that indicates to repeat events that "asynch action is in progress". Right before the async write, which must be the last thing the event does. The asynch callback can perform any necessary follow up actions before resetting the state. Or kick off additional async actions, deferring the state updates.