                           (let [metadata (get-metadata metadata-producers conf)]
 	                          (dosync 
                               (alter brokers-metadata (fn [x] metadata))
-                              (alter producer-ref (fn [x] (update-producers @metadata @x)))
+                              (alter producer-ref (fn [x] (update-producers metadata x)))
                               )))
                            
         metadata-fixdelay 


(defn- get-partition-count [topic brokers-metadata]
  (count (get brokers-metadata topic)))


(defn select-rr-partition! [topic {:keys [topic-partition-ref brokers-metadata] :as state}]

                               (into {} (filter (complement nil?)
                                            (map (fn [[k producer-buffer]]
								                                                    (let [[topic partition] (clojure.string/split k #"\:")
								                                                          host (smart-get producer-buffer :host)]
								                                                      (if (some #(= (:host %) host) (smart-get metadata topic))
								                                                        [k producer-buffer]
								                                                        (do
                                                                          (prn "closing producer " host " topic " topic " prodbuffer " producer-buffer)
								                                                          (close-producer-buffer! producer-buffer)
								                                                          nil))))
                                              m))))
