Last active
December 10, 2015 02:28
-
-
Save killme2008/4367826 to your computer and use it in GitHub Desktop.
实现一个API,API内部有两个http接口A,B并发调用,如果都在200ms内返回,则合并结果输出,如果B比A慢,且B耗时超过200ms,则丢弃B调用只返回A结果
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn invoke [fs] | |
(map #(deref % 200 nil) (map future-call fs))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
clojure真多这种提高生产力的库函数