Skip to content
Browse files

Back off after exceptions.

  • Loading branch information...
1 parent 091f954 commit d8c1cf138f875a2782f2b7f38b487efed14244fe @ieure committed Feb 20, 2010
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/twidoop.clj
View
8 src/twidoop.clj
@@ -61,9 +61,11 @@ Type can be `sample' or `firehose'."
(defmacro forever
"Run forms forever, ignoring exceptions."
[form]
- `(while true
- (try ~form
- (catch Exception e#))))
+ `(let [attempts# 0]
+ (while true
+ (try ~form
+ (catch Exception e#
+ (Thread/sleep (* 2000 (inc attempts#))))))))
(defn save-statuses [url out-path]
"Save Twitter statuses into HDFS."

0 comments on commit d8c1cf1

Please sign in to comment.
Something went wrong with that request. Please try again.