waitDelay ( float delay , string locker ) : void

You can use this function to be sure 2 actions are not executed too closely. If it is the fist call, this function does not block the execution, but the second call will block the execution if it is too close to the first one.
It is often usefull when you have sevral threads. For example, you have a site which ban you if you send 2 requests in a delay less than 100ms (because a human cannot do it). So to be sure there is a minimum delay of 1 second, you can code:

urls = ["http://site.cm/page1.html","http://site.cm/page2.html","http://site.cm/page3.html","http://site.cm/page4.html"]
parallelize(urls, 2, {url->
waitDelay(1000, "get_source")
def html = getPage(url)

Note: the locker is the same than the locker of the synchronize function.

See also




Period you need between each passage. In milliseconds.


A unique code which make reference to this check.