Skip to content

Instantly share code, notes, and snippets.

@killme2008
Last active December 10, 2015 02:28
Show Gist options
  • Save killme2008/4367826 to your computer and use it in GitHub Desktop.
Save killme2008/4367826 to your computer and use it in GitHub Desktop.
实现一个API,API内部有两个http接口A,B并发调用,如果都在200ms内返回,则合并结果输出,如果B比A慢,且B耗时超过200ms,则丢弃B调用只返回A结果
(defn invoke [fs]
(map #(deref % 200 nil) (map future-call fs)))
@Arbow
Copy link

Arbow commented Dec 24, 2012

clojure真多这种提高生产力的库函数

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment