Github user zhuoliu commented on a diff in the pull request:

    https://github.com/apache/storm/pull/847#discussion_r43797156
  
    --- Diff: storm-core/src/clj/backtype/storm/daemon/worker.clj ---
    @@ -310,6 +313,26 @@
         [node (Integer/valueOf port-str)]
         ))
     
    +(defn mk-refresh-load [worker]
    +  (let [local-tasks (set (:task-ids worker))
    +        remote-tasks (set/difference (worker-outbound-tasks worker) 
local-tasks)
    +        short-executor-receive-queue-map 
(:short-executor-receive-queue-map worker)
    +        next-update (atom 0)]
    +    (fn this
    +      ([]
    +        (let [^LoadMapping load-mapping (:load-mapping worker)
    +              local-pop (map-val (fn [queue]
    +                                   (let [q-metrics (.getMetrics queue)]
    +                                     (/ (double (.population q-metrics)) 
(.capacity q-metrics))))
    +                                 short-executor-receive-queue-map)
    +              remote-load (reduce merge (for [[np conn] 
@(:cached-node+port->socket worker)] (into {} (.getLoad conn remote-tasks))))
    +              now (System/currentTimeMillis)]
    +          (.setLocal load-mapping local-pop)
    +          (.setRemote load-mapping remote-load)
    +          (when (> now @next-update)
    +            (.sendLoadMetrics (:receiver worker) local-pop)
    +            (reset! next-update (+ 5000 now))))))))
    --- End diff --
    
    We may bind the "5000" as a value in let[].


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to