ColdFusion 8: Update to Aggregator UDF

I’m posting an update to the aggregator code I blogged about yesterday. This update does a few things - and demonstrates a bug (I think) in CFTHREAD inside a UDF.

First off - I took the suggestion of using an array of feeds instead of a list in case your URL contains a comma. I also let you pass in one URL by itself. The code to handle this is relatively simple. I see if arguments.feeds is not an array. If it isn’t, I create a new array and set the string as the first item.

Secondly - the bug I mentioned above. If you call the UDF I wrote yesterday twice (or more), then you get an error stating that the thread named “thread_X” cannot be created twice. It was my understanding that a thread created inside a UDF was unique to the UDF. I’ve got a bug open with Adobe on this now. To fix this for now - I simply switched to threads named by UUID.

Lastly, I added some basic error checking to the feed retrieval. If a feed URL is bad, or times out, then I return an empty query for that particular feed.

This will be posted to CFLib later in the week when I set up “CF8” as a supported platform. You can download the zip (which has the UDF and a few test calls) here.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments