{"action":"created","issue":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/18979","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/18979/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/18979/comments","events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/18979/events","html_url":"https://github.com/kubernetes/kubernetes/pull/18979","id":123329260,"number":18979,"title":"Improve the code in pkg/controller/job/controller.go","user":{"login":"WeixuZhuang","id":15804885,"avatar_url":"https://avatars.githubusercontent.com/u/15804885?v=3","gravatar_id":"","url":"https://api.github.com/users/WeixuZhuang","html_url":"https://github.com/WeixuZhuang","followers_url":"https://api.github.com/users/WeixuZhuang/followers","following_url":"https://api.github.com/users/WeixuZhuang/following{/other_user}","gists_url":"https://api.github.com/users/WeixuZhuang/gists{/gist_id}","starred_url":"https://api.github.com/users/WeixuZhuang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WeixuZhuang/subscriptions","organizations_url":"https://api.github.com/users/WeixuZhuang/orgs","repos_url":"https://api.github.com/users/WeixuZhuang/repos","events_url":"https://api.github.com/users/WeixuZhuang/events{/privacy}","received_events_url":"https://api.github.com/users/WeixuZhuang/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/cla:%20yes","name":"cla: yes","color":"bfe5bf"},{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/size/S","name":"size/S","color":"77bb00"}],"state":"open","locked":false,"assignee":{"login":"thockin","id":5595220,"avatar_url":"https://avatars.githubusercontent.com/u/5595220?v=3","gravatar_id":"","url":"https://api.github.com/users/thockin","html_url":"https://github.com/thockin","followers_url":"https://api.github.com/users/thockin/followers","following_url":"https://api.github.com/users/thockin/following{/other_user}","gists_url":"https://api.github.com/users/thockin/gists{/gist_id}","starred_url":"https://api.github.com/users/thockin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thockin/subscriptions","organizations_url":"https://api.github.com/users/thockin/orgs","repos_url":"https://api.github.com/users/thockin/repos","events_url":"https://api.github.com/users/thockin/events{/privacy}","received_events_url":"https://api.github.com/users/thockin/received_events","type":"User","site_admin":false},"milestone":null,"comments":7,"created_at":"2015-12-21T18:09:45Z","updated_at":"2015-12-29T17:45:19Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/18979","html_url":"https://github.com/kubernetes/kubernetes/pull/18979","diff_url":"https://github.com/kubernetes/kubernetes/pull/18979.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/18979.patch"},"body":"Everytime we have a pod creationg, update or deletion, we will enqueue the\r\ncontroller that manages it and update its expections. And this queue consumed\r\nat the worker().\r\n\r\nIn my commit, we check if the controller is already in this queue. If it is not,\r\nenqueue it. If it is and it is not at the head of this queue, abort inserting since\r\nit will do replicated job. If it is in the head of this queue, still need insert it.\r\nAt the head of this queue means this item may be consuming right now, the update\r\nmay not work in this consuming. We still need to enqueue it. Also, I add a new func\r\nHead() in workqueue obj which will return the head of this queue."},"comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments/167841972","html_url":"https://github.com/kubernetes/kubernetes/pull/18979#issuecomment-167841972","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/18979","id":167841972,"user":{"login":"WeixuZhuang","id":15804885,"avatar_url":"https://avatars.githubusercontent.com/u/15804885?v=3","gravatar_id":"","url":"https://api.github.com/users/WeixuZhuang","html_url":"https://github.com/WeixuZhuang","followers_url":"https://api.github.com/users/WeixuZhuang/followers","following_url":"https://api.github.com/users/WeixuZhuang/following{/other_user}","gists_url":"https://api.github.com/users/WeixuZhuang/gists{/gist_id}","starred_url":"https://api.github.com/users/WeixuZhuang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WeixuZhuang/subscriptions","organizations_url":"https://api.github.com/users/WeixuZhuang/orgs","repos_url":"https://api.github.com/users/WeixuZhuang/repos","events_url":"https://api.github.com/users/WeixuZhuang/events{/privacy}","received_events_url":"https://api.github.com/users/WeixuZhuang/received_events","type":"User","site_admin":false},"created_at":"2015-12-29T17:45:19Z","updated_at":"2015-12-29T17:45:19Z","body":"Hi @soltysh , this is my point.\r\n\r\nIn current solution, every time we have any update, it will go into syncJob, check everything then run until line 361 and find out it does not need synchronize. My solution will avoid this case, it only enqueue controllers don't inside the workqueue. This avoid most unnecessary checking which I assumed a little bit resource(time) wasting. I think my solution will be a little bit better?(since in syncJob() before before line 361, it has controller.FilterActivePods, podStore.Pods(job.Namespace).List etc. and access the storage several time to get the status, expections etc. I think it will be more time consuming)"}}