{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/online-hibernation/pulls/comments/191821398","pull_request_review_id":124442690,"id":191821398,"diff_hunk":"@@ -98,381 +102,305 @@ func (s *Sleeper) startWorker(namespaces <-chan string) {\n \t}\n }\n \n-func (s *Sleeper) applyProjectSleep(namespace string, sleepTime, wakeTime time.Time) error {\n-\tif s.config.DryRun {\n-\t\tglog.V(2).Infof(\"Force-sleeper DryRun: Simulating project( %s )sleep in dry run mode\", namespace)\n-\t}\n-\tproj, err := s.resources.GetProject(namespace)\n-\tif err != nil {\n-\t\treturn fmt.Errorf(\"Force-sleeper: %s\", err)\n-\t}\n-\tprojectCopy, err := cache.Scheme.DeepCopy(proj)\n+// Syncs a project and determines if force-sleep is needed\n+func (s *Sleeper) syncProject(namespace string) {\n+\tglog.V(2).Infof(\"Force-sleeper: Syncing project( %s )\", namespace)\n+\tisAsleep, err := s.resourceStore.IsAsleep(namespace)\n \tif err != nil {\n-\t\treturn fmt.Errorf(\"Force-sleeper: %s\", err)\n+\t\tglog.Errorf(\"Force-sleeper: Error: %s\", err)\n+\t\treturn\n \t}\n-\tproject := projectCopy.(*cache.ResourceObject)\n-\tproject.LastSleepTime = sleepTime\n-\tproject.IsAsleep = true\n-\terr = s.resources.Indexer.UpdateResourceObject(project)\n+\tproject, err := s.resourceStore.ProjectList.Get(namespace)\n \tif err != nil {\n-\t\treturn fmt.Errorf(\"Force-sleeper: %s\", err)\n+\t\tglog.Errorf(\"Force-sleeper: Error: %s\", err)\n+\t\treturn\n \t}\n-\t// Check that resource was updated\n-\tsleepingProj, err := s.resources.GetProject(namespace)\n-\tif err != nil {\n-\t\treturn fmt.Errorf(\"Force-sleeper: %s\", err)\n+\tvar lastSleepTime time.Time\n+\tif lastSleepTimeStr, ok := project.Annotations[cache.ProjectLastSleepTime]; ok {\n+\t\t// This is string eq of time.Time{}\n+\t\tif lastSleepTimeStr == \"0001-01-01 00:00:00 +0000 UTC\" {","path":"pkg/forcesleep/forcesleep.go","position":147,"original_position":147,"commit_id":"099b13849a6b860897e9755c8fc34aa0bb154308","original_commit_id":"9cbc22fcad3a7795508d1ec7f4fc88df40976b55","user":{"login":"damemi","id":1839101,"avatar_url":"https://avatars1.githubusercontent.com/u/1839101?v=4","gravatar_id":"","url":"https://api.github.com/users/damemi","html_url":"https://github.com/damemi","followers_url":"https://api.github.com/users/damemi/followers","following_url":"https://api.github.com/users/damemi/following{/other_user}","gists_url":"https://api.github.com/users/damemi/gists{/gist_id}","starred_url":"https://api.github.com/users/damemi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damemi/subscriptions","organizations_url":"https://api.github.com/users/damemi/orgs","repos_url":"https://api.github.com/users/damemi/repos","events_url":"https://api.github.com/users/damemi/events{/privacy}","received_events_url":"https://api.github.com/users/damemi/received_events","type":"User","site_admin":false},"body":"do you need this check, or could you just parse whatever `lastSleepTimeStr` is and then check if it `IsZero()` further down?","created_at":"2018-05-30T15:47:16Z","updated_at":"2018-05-30T15:55:08Z","html_url":"https://github.com/openshift/online-hibernation/pull/64#discussion_r191821398","pull_request_url":"https://api.github.com/repos/openshift/online-hibernation/pulls/64","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/openshift/online-hibernation/pulls/comments/191821398"},"html":{"href":"https://github.com/openshift/online-hibernation/pull/64#discussion_r191821398"},"pull_request":{"href":"https://api.github.com/repos/openshift/online-hibernation/pulls/64"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/online-hibernation/pulls/64","id":186966195,"html_url":"https://github.com/openshift/online-hibernation/pull/64","diff_url":"https://github.com/openshift/online-hibernation/pull/64.diff","patch_url":"https://github.com/openshift/online-hibernation/pull/64.patch","issue_url":"https://api.github.com/repos/openshift/online-hibernation/issues/64","number":64,"state":"open","locked":false,"title":"Service idler cache refactor","user":{"login":"sallyom","id":11166065,"avatar_url":"https://avatars1.githubusercontent.com/u/11166065?v=4","gravatar_id":"","url":"https://api.github.com/users/sallyom","html_url":"https://github.com/sallyom","followers_url":"https://api.github.com/users/sallyom/followers","following_url":"https://api.github.com/users/sallyom/following{/other_user}","gists_url":"https://api.github.com/users/sallyom/gists{/gist_id}","starred_url":"https://api.github.com/users/sallyom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sallyom/subscriptions","organizations_url":"https://api.github.com/users/sallyom/orgs","repos_url":"https://api.github.com/users/sallyom/repos","events_url":"https://api.github.com/users/sallyom/events{/privacy}","received_events_url":"https://api.github.com/users/sallyom/received_events","type":"User","site_admin":false},"body":"@damemi I closed previous prs, I made this branch where commits are organized, deps separate.\r\n1) Remove custom ResourceObject and implement service-idler\r\n2) update Dockerfile,Makefile\r\n3) update hibernation template\r\n4) update glide,vendor,deps","created_at":"2018-05-09T15:56:40Z","updated_at":"2018-05-30T15:55:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"26eecbdc9e0723a511e457f36544362d4603b4df","assignee":null,"assignees":[],"requested_reviewers":[{"login":"DirectXMan12","id":119737,"avatar_url":"https://avatars1.githubusercontent.com/u/119737?v=4","gravatar_id":"","url":"https://api.github.com/users/DirectXMan12","html_url":"https://github.com/DirectXMan12","followers_url":"https://api.github.com/users/DirectXMan12/followers","following_url":"https://api.github.com/users/DirectXMan12/following{/other_user}","gists_url":"https://api.github.com/users/DirectXMan12/gists{/gist_id}","starred_url":"https://api.github.com/users/DirectXMan12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DirectXMan12/subscriptions","organizations_url":"https://api.github.com/users/DirectXMan12/orgs","repos_url":"https://api.github.com/users/DirectXMan12/repos","events_url":"https://api.github.com/users/DirectXMan12/events{/privacy}","received_events_url":"https://api.github.com/users/DirectXMan12/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":742022176,"url":"https://api.github.com/repos/openshift/online-hibernation/labels/size/XXL","name":"size/XXL","color":"ee0000","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/openshift/online-hibernation/pulls/64/commits","review_comments_url":"https://api.github.com/repos/openshift/online-hibernation/pulls/64/comments","review_comment_url":"https://api.github.com/repos/openshift/online-hibernation/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/online-hibernation/issues/64/comments","statuses_url":"https://api.github.com/repos/openshift/online-hibernation/statuses/099b13849a6b860897e9755c8fc34aa0bb154308","head":{"label":"sallyom:service-idler-cache-refactor","ref":"service-idler-cache-refactor","sha":"099b13849a6b860897e9755c8fc34aa0bb154308","user":{"login":"sallyom","id":11166065,"avatar_url":"https://avatars1.githubusercontent.com/u/11166065?v=4","gravatar_id":"","url":"https://api.github.com/users/sallyom","html_url":"https://github.com/sallyom","followers_url":"https://api.github.com/users/sallyom/followers","following_url":"https://api.github.com/users/sallyom/following{/other_user}","gists_url":"https://api.github.com/users/sallyom/gists{/gist_id}","starred_url":"https://api.github.com/users/sallyom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sallyom/subscriptions","organizations_url":"https://api.github.com/users/sallyom/orgs","repos_url":"https://api.github.com/users/sallyom/repos","events_url":"https://api.github.com/users/sallyom/events{/privacy}","received_events_url":"https://api.github.com/users/sallyom/received_events","type":"User","site_admin":false},"repo":{"id":100408669,"name":"online-hibernation","full_name":"sallyom/online-hibernation","owner":{"login":"sallyom","id":11166065,"avatar_url":"https://avatars1.githubusercontent.com/u/11166065?v=4","gravatar_id":"","url":"https://api.github.com/users/sallyom","html_url":"https://github.com/sallyom","followers_url":"https://api.github.com/users/sallyom/followers","following_url":"https://api.github.com/users/sallyom/following{/other_user}","gists_url":"https://api.github.com/users/sallyom/gists{/gist_id}","starred_url":"https://api.github.com/users/sallyom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sallyom/subscriptions","organizations_url":"https://api.github.com/users/sallyom/orgs","repos_url":"https://api.github.com/users/sallyom/repos","events_url":"https://api.github.com/users/sallyom/events{/privacy}","received_events_url":"https://api.github.com/users/sallyom/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sallyom/online-hibernation","description":null,"fork":true,"url":"https://api.github.com/repos/sallyom/online-hibernation","forks_url":"https://api.github.com/repos/sallyom/online-hibernation/forks","keys_url":"https://api.github.com/repos/sallyom/online-hibernation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sallyom/online-hibernation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sallyom/online-hibernation/teams","hooks_url":"https://api.github.com/repos/sallyom/online-hibernation/hooks","issue_events_url":"https://api.github.com/repos/sallyom/online-hibernation/issues/events{/number}","events_url":"https://api.github.com/repos/sallyom/online-hibernation/events","assignees_url":"https://api.github.com/repos/sallyom/online-hibernation/assignees{/user}","branches_url":"https://api.github.com/repos/sallyom/online-hibernation/branches{/branch}","tags_url":"https://api.github.com/repos/sallyom/online-hibernation/tags","blobs_url":"https://api.github.com/repos/sallyom/online-hibernation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sallyom/online-hibernation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sallyom/online-hibernation/git/refs{/sha}","trees_url":"https://api.github.com/repos/sallyom/online-hibernation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sallyom/online-hibernation/statuses/{sha}","languages_url":"https://api.github.com/repos/sallyom/online-hibernation/languages","stargazers_url":"https://api.github.com/repos/sallyom/online-hibernation/stargazers","contributors_url":"https://api.github.com/repos/sallyom/online-hibernation/contributors","subscribers_url":"https://api.github.com/repos/sallyom/online-hibernation/subscribers","subscription_url":"https://api.github.com/repos/sallyom/online-hibernation/subscription","commits_url":"https://api.github.com/repos/sallyom/online-hibernation/commits{/sha}","git_commits_url":"https://api.github.com/repos/sallyom/online-hibernation/git/commits{/sha}","comments_url":"https://api.github.com/repos/sallyom/online-hibernation/comments{/number}","issue_comment_url":"https://api.github.com/repos/sallyom/online-hibernation/issues/comments{/number}","contents_url":"https://api.github.com/repos/sallyom/online-hibernation/contents/{+path}","compare_url":"https://api.github.com/repos/sallyom/online-hibernation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sallyom/online-hibernation/merges","archive_url":"https://api.github.com/repos/sallyom/online-hibernation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sallyom/online-hibernation/downloads","issues_url":"https://api.github.com/repos/sallyom/online-hibernation/issues{/number}","pulls_url":"https://api.github.com/repos/sallyom/online-hibernation/pulls{/number}","milestones_url":"https://api.github.com/repos/sallyom/online-hibernation/milestones{/number}","notifications_url":"https://api.github.com/repos/sallyom/online-hibernation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sallyom/online-hibernation/labels{/name}","releases_url":"https://api.github.com/repos/sallyom/online-hibernation/releases{/id}","deployments_url":"https://api.github.com/repos/sallyom/online-hibernation/deployments","created_at":"2017-08-15T18:50:27Z","updated_at":"2018-04-12T17:15:54Z","pushed_at":"2018-05-22T15:46:31Z","git_url":"git://github.com/sallyom/online-hibernation.git","ssh_url":"git@github.com:sallyom/online-hibernation.git","clone_url":"https://github.com/sallyom/online-hibernation.git","svn_url":"https://github.com/sallyom/online-hibernation","homepage":null,"size":51335,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"openshift:master","ref":"master","sha":"01f1251080ad8ab43ebea1be7da8658c19bb7286","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars3.githubusercontent.com/u/792337?v=4","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":99231409,"name":"online-hibernation","full_name":"openshift/online-hibernation","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars3.githubusercontent.com/u/792337?v=4","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/online-hibernation","description":null,"fork":false,"url":"https://api.github.com/repos/openshift/online-hibernation","forks_url":"https://api.github.com/repos/openshift/online-hibernation/forks","keys_url":"https://api.github.com/repos/openshift/online-hibernation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/online-hibernation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/online-hibernation/teams","hooks_url":"https://api.github.com/repos/openshift/online-hibernation/hooks","issue_events_url":"https://api.github.com/repos/openshift/online-hibernation/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/online-hibernation/events","assignees_url":"https://api.github.com/repos/openshift/online-hibernation/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/online-hibernation/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/online-hibernation/tags","blobs_url":"https://api.github.com/repos/openshift/online-hibernation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/online-hibernation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/online-hibernation/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/online-hibernation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/online-hibernation/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/online-hibernation/languages","stargazers_url":"https://api.github.com/repos/openshift/online-hibernation/stargazers","contributors_url":"https://api.github.com/repos/openshift/online-hibernation/contributors","subscribers_url":"https://api.github.com/repos/openshift/online-hibernation/subscribers","subscription_url":"https://api.github.com/repos/openshift/online-hibernation/subscription","commits_url":"https://api.github.com/repos/openshift/online-hibernation/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/online-hibernation/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/online-hibernation/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/online-hibernation/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/online-hibernation/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/online-hibernation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/online-hibernation/merges","archive_url":"https://api.github.com/repos/openshift/online-hibernation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/online-hibernation/downloads","issues_url":"https://api.github.com/repos/openshift/online-hibernation/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/online-hibernation/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/online-hibernation/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/online-hibernation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/online-hibernation/labels{/name}","releases_url":"https://api.github.com/repos/openshift/online-hibernation/releases{/id}","deployments_url":"https://api.github.com/repos/openshift/online-hibernation/deployments","created_at":"2017-08-03T12:43:06Z","updated_at":"2018-05-17T14:39:48Z","pushed_at":"2018-05-22T15:46:32Z","git_url":"git://github.com/openshift/online-hibernation.git","ssh_url":"git@github.com:openshift/online-hibernation.git","clone_url":"https://github.com/openshift/online-hibernation.git","svn_url":"https://github.com/openshift/online-hibernation","homepage":null,"size":46494,"stargazers_count":6,"watchers_count":6,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":12,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":12,"open_issues":6,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/online-hibernation/pulls/64"},"html":{"href":"https://github.com/openshift/online-hibernation/pull/64"},"issue":{"href":"https://api.github.com/repos/openshift/online-hibernation/issues/64"},"comments":{"href":"https://api.github.com/repos/openshift/online-hibernation/issues/64/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/online-hibernation/pulls/64/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/online-hibernation/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/online-hibernation/pulls/64/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/online-hibernation/statuses/099b13849a6b860897e9755c8fc34aa0bb154308"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"damemi"}}