Github user revans2 commented on a diff in the pull request: https://github.com/apache/storm/pull/700#discussion_r38023405 --- Diff: storm-core/src/clj/backtype/storm/daemon/worker.clj --- @@ -510,15 +554,21 @@ )) ) credentials (atom initial-credentials) - check-credentials-changed (fn [] - (let [new-creds (.credentials (:storm-cluster-state worker) storm-id nil)] - (when-not (= new-creds @credentials) ;;This does not have to be atomic, worst case we update when one is not needed - (AuthUtils/updateSubject subject auto-creds new-creds) - (dofor [e @executors] (.credentials-changed e new-creds)) - (reset! credentials new-creds)))) - ] - (.credentials (:storm-cluster-state worker) storm-id (fn [args] (check-credentials-changed))) - (schedule-recurring (:refresh-credentials-timer worker) 0 (conf TASK-CREDENTIALS-POLL-SECS) check-credentials-changed) + check-credentials-throttle-changed (fn [] + (let [callback (fn cb [& ignored] + (let [throttle-on (.topology-backpressure (:storm-cluster-state worker) storm-id cb)] + (reset! (:throttle-on worker) throttle-on))) + new-throttle-on (if ((:storm-conf worker) TOPOLOGY-BACKPRESSURE-ENABLE) + (.topology-backpressure (:storm-cluster-state worker) storm-id callback) nil) + new-creds (.credentials (:storm-cluster-state worker) storm-id nil)] + (if ((:storm-conf worker) TOPOLOGY-BACKPRESSURE-ENABLE) + (reset! (:throttle-on worker) new-throttle-on)) + (when-not (= new-creds @credentials) ;;This does not have to be atomic, worst case we update when one is not needed + (AuthUtils/updateSubject subject auto-creds new-creds) + (dofor [e @executors] (.credentials-changed e new-creds)) + (reset! credentials new-creds))))] + (.credentials (:storm-cluster-state worker) storm-id (fn [args] (check-credentials-throttle-changed))) --- End diff -- I think I would prefer to have two functions instead of just one. Both can be scheduled on the same timer, but keeping them separate seems cleaner.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---