tgauchat
(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy)
2
If you really only need to wait 1 or 2 seconds (1000 to 2000 milliseconds), then, frankly, using a busy-wait loop may be the most practical way to just get this done.
This is inefficient / impolite code, but since it won’t run very frequently or loop for very long, no big deal.
Add this method and call it when needed. Remove the log.debug lines after testing.
def pause(millis) {
def passed = 0
def now = new Date().time
log.debug "pausing... at Now: $now"
/* This loop is an impolite busywait. We need to be given a true sleep() method, please. */
while ( passed < millis ) {
passed = new Date().time - now
}
log.debug "... DONE pausing."
}