asyncAnyOf

Returns a Future that completes as soon as the first Future in the array completes, with that Future's result, or its error if it failed.

asyncAnyOf(futures) → returns any

This function requires Adobe ColdFusion 2025 and up.  Not supported on Lucee, etc.

Argument Reference

futures array
Required

An array of Future objects, such as those returned by runAsync().

Examples
Sample code invoking the asyncAnyOf function

Returns the result of whichever task finishes first.

slow = runAsync(function(){ sleep(200); return "slow"; });
fast = runAsync(function(){ return "fast"; });
writeOutput(asyncAnyOf([slow, fast]).get());

Expected Result: fast

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub