-
Notifications
You must be signed in to change notification settings - Fork 0
/
14-anyOf.cfc
38 lines (31 loc) · 1.15 KB
/
14-anyOf.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
component extends="../BaseTask" {
function dns1() {
sleep( randRange( 200, 700 ) );
return "1.1.1.1";
}
function dns2() {
sleep( randRange( 200, 700 ) );
return "8.8.8.8";
}
function getFeedData( feed ) {
print.greenLine( "Getting feed: #arguments.feed#" ).toConsole();;
cffeed( action="read", source=feed, properties="local.properties", query="local.data" );
return {
"title" : local.properties.title,
"items" : local.data.reduce( ( result, row ) => {
result.append( row.title )
return result;
}, [] )
}
}
function run(){
var feeds = [
() => getFeedData( "http://feeds.feedburner.com/raymondcamdensblog" ),
() => getFeedData( "http://feeds.feedburner.com/ColdfusionbloggersorgFeed" ),
() => getFeedData( "https://feeds.transistor.fm/modernize-or-die-podcast-cfml-news-edition" )
];
var future = asyncManager.anyOf( feeds );
print.blueLine( "The winner is: #future.get().title#" ).toConsole();
print.blueLine( "Race is over!" );
}
}