{"action":"created","comment":{"url":"https://api.github.com/repos/implydata/pivot/pulls/comments/75822126","id":75822126,"diff_hunk":"@@ -0,0 +1,87 @@\n+/*\n+ * Copyright 2015-2016 Imply Data, Inc.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+import * as Q from \"q\";\n+import { Logger } from 'logger-tracker';\n+import { Timekeeper } from \"../../models/timekeeper/timekeeper\";\n+\n+export interface Check {\n+  (): Q.Promise<Date>;\n+}\n+\n+export class TimeMonitor {\n+  public logger: Logger;\n+  public regularCheckInterval: number;\n+  public specialCheckInterval: number;\n+  public timekeeper: Timekeeper;\n+  public checks: Lookup<Check>;\n+  private doingChecks = false;\n+\n+  constructor(logger: Logger) {\n+    this.logger = logger;\n+    this.checks = {};\n+    this.regularCheckInterval = 60000;\n+    this.specialCheckInterval = 60000;\n+    this.timekeeper = Timekeeper.EMPTY;\n+    setInterval(this.doChecks.bind(this), 1000);\n+  }\n+\n+  addCheck(name: string, check: Check): this {","path":"src/common/utils/time-monitor/time-monitor.ts","position":42,"original_position":42,"commit_id":"67c6c3668523122ea448997099e44ee8c7f4d8d3","original_commit_id":"67c6c3668523122ea448997099e44ee8c7f4d8d3","user":{"login":"lorem--ipsum","id":1224709,"avatar_url":"https://avatars.githubusercontent.com/u/1224709?v=3","gravatar_id":"","url":"https://api.github.com/users/lorem--ipsum","html_url":"https://github.com/lorem--ipsum","followers_url":"https://api.github.com/users/lorem--ipsum/followers","following_url":"https://api.github.com/users/lorem--ipsum/following{/other_user}","gists_url":"https://api.github.com/users/lorem--ipsum/gists{/gist_id}","starred_url":"https://api.github.com/users/lorem--ipsum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lorem--ipsum/subscriptions","organizations_url":"https://api.github.com/users/lorem--ipsum/orgs","repos_url":"https://api.github.com/users/lorem--ipsum/repos","events_url":"https://api.github.com/users/lorem--ipsum/events{/privacy}","received_events_url":"https://api.github.com/users/lorem--ipsum/received_events","type":"User","site_admin":false},"body":"This should be called `addOrUpdateCheck` IMHO","created_at":"2016-08-23T08:30:44Z","updated_at":"2016-08-23T08:30:44Z","html_url":"https://github.com/implydata/pivot/pull/358#discussion_r75822126","pull_request_url":"https://api.github.com/repos/implydata/pivot/pulls/358","_links":{"self":{"href":"https://api.github.com/repos/implydata/pivot/pulls/comments/75822126"},"html":{"href":"https://github.com/implydata/pivot/pull/358#discussion_r75822126"},"pull_request":{"href":"https://api.github.com/repos/implydata/pivot/pulls/358"}}},"pull_request":{"url":"https://api.github.com/repos/implydata/pivot/pulls/358","id":82274096,"html_url":"https://github.com/implydata/pivot/pull/358","diff_url":"https://github.com/implydata/pivot/pull/358.diff","patch_url":"https://github.com/implydata/pivot/pull/358.patch","issue_url":"https://api.github.com/repos/implydata/pivot/issues/358","number":358,"state":"open","locked":false,"title":"Timekeeper","user":{"login":"vogievetsky","id":177816,"avatar_url":"https://avatars.githubusercontent.com/u/177816?v=3","gravatar_id":"","url":"https://api.github.com/users/vogievetsky","html_url":"https://github.com/vogievetsky","followers_url":"https://api.github.com/users/vogievetsky/followers","following_url":"https://api.github.com/users/vogievetsky/following{/other_user}","gists_url":"https://api.github.com/users/vogievetsky/gists{/gist_id}","starred_url":"https://api.github.com/users/vogievetsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vogievetsky/subscriptions","organizations_url":"https://api.github.com/users/vogievetsky/orgs","repos_url":"https://api.github.com/users/vogievetsky/repos","events_url":"https://api.github.com/users/vogievetsky/events{/privacy}","received_events_url":"https://api.github.com/users/vogievetsky/received_events","type":"User","site_admin":false},"body":"Are you ready to read the word `timekeeper` a lot?\r\n\r\nCode:\r\n\r\n- Removed dataCube.maxTime and moved it into Timekeeper the idea is that Timekeeper is in charge of all time keeping and serves as a cache for dataCube max times also. This is needed to ensure that the settings are not constantly updated to keep up with the passage of time.\r\n- a `timekeeper` object is threaded into any function that used to implicitly reply on `new Date()`\r\n- Added `TimeMonitor` - the thing on the server that periodically pols dataCubes for updates.\r\n- Removed `refresh` from `refreshRule`. Might want to add `DataCube#defaultAutoRefresh` as a parameter\r\n\r\nBuild:\r\n\r\n- Playing with native TS build and lint\r\n- Mocks are now auto generated by `mkmodel`\r\n","created_at":"2016-08-22T22:24:44Z","updated_at":"2016-08-23T08:30:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5fa0ddb81a1a0cfdc3c478a30f02109f09b9c3fa","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/implydata/pivot/pulls/358/commits","review_comments_url":"https://api.github.com/repos/implydata/pivot/pulls/358/comments","review_comment_url":"https://api.github.com/repos/implydata/pivot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/implydata/pivot/issues/358/comments","statuses_url":"https://api.github.com/repos/implydata/pivot/statuses/67c6c3668523122ea448997099e44ee8c7f4d8d3","head":{"label":"implydata:timekeeper","ref":"timekeeper","sha":"67c6c3668523122ea448997099e44ee8c7f4d8d3","user":{"login":"implydata","id":11660206,"avatar_url":"https://avatars.githubusercontent.com/u/11660206?v=3","gravatar_id":"","url":"https://api.github.com/users/implydata","html_url":"https://github.com/implydata","followers_url":"https://api.github.com/users/implydata/followers","following_url":"https://api.github.com/users/implydata/following{/other_user}","gists_url":"https://api.github.com/users/implydata/gists{/gist_id}","starred_url":"https://api.github.com/users/implydata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/implydata/subscriptions","organizations_url":"https://api.github.com/users/implydata/orgs","repos_url":"https://api.github.com/users/implydata/repos","events_url":"https://api.github.com/users/implydata/events{/privacy}","received_events_url":"https://api.github.com/users/implydata/received_events","type":"Organization","site_admin":false},"repo":{"id":39598888,"name":"pivot","full_name":"implydata/pivot","owner":{"login":"implydata","id":11660206,"avatar_url":"https://avatars.githubusercontent.com/u/11660206?v=3","gravatar_id":"","url":"https://api.github.com/users/implydata","html_url":"https://github.com/implydata","followers_url":"https://api.github.com/users/implydata/followers","following_url":"https://api.github.com/users/implydata/following{/other_user}","gists_url":"https://api.github.com/users/implydata/gists{/gist_id}","starred_url":"https://api.github.com/users/implydata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/implydata/subscriptions","organizations_url":"https://api.github.com/users/implydata/orgs","repos_url":"https://api.github.com/users/implydata/repos","events_url":"https://api.github.com/users/implydata/events{/privacy}","received_events_url":"https://api.github.com/users/implydata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/implydata/pivot","description":"An interactive data exploration UI for Druid","fork":false,"url":"https://api.github.com/repos/implydata/pivot","forks_url":"https://api.github.com/repos/implydata/pivot/forks","keys_url":"https://api.github.com/repos/implydata/pivot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/implydata/pivot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/implydata/pivot/teams","hooks_url":"https://api.github.com/repos/implydata/pivot/hooks","issue_events_url":"https://api.github.com/repos/implydata/pivot/issues/events{/number}","events_url":"https://api.github.com/repos/implydata/pivot/events","assignees_url":"https://api.github.com/repos/implydata/pivot/assignees{/user}","branches_url":"https://api.github.com/repos/implydata/pivot/branches{/branch}","tags_url":"https://api.github.com/repos/implydata/pivot/tags","blobs_url":"https://api.github.com/repos/implydata/pivot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/implydata/pivot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/implydata/pivot/git/refs{/sha}","trees_url":"https://api.github.com/repos/implydata/pivot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/implydata/pivot/statuses/{sha}","languages_url":"https://api.github.com/repos/implydata/pivot/languages","stargazers_url":"https://api.github.com/repos/implydata/pivot/stargazers","contributors_url":"https://api.github.com/repos/implydata/pivot/contributors","subscribers_url":"https://api.github.com/repos/implydata/pivot/subscribers","subscription_url":"https://api.github.com/repos/implydata/pivot/subscription","commits_url":"https://api.github.com/repos/implydata/pivot/commits{/sha}","git_commits_url":"https://api.github.com/repos/implydata/pivot/git/commits{/sha}","comments_url":"https://api.github.com/repos/implydata/pivot/comments{/number}","issue_comment_url":"https://api.github.com/repos/implydata/pivot/issues/comments{/number}","contents_url":"https://api.github.com/repos/implydata/pivot/contents/{+path}","compare_url":"https://api.github.com/repos/implydata/pivot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/implydata/pivot/merges","archive_url":"https://api.github.com/repos/implydata/pivot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/implydata/pivot/downloads","issues_url":"https://api.github.com/repos/implydata/pivot/issues{/number}","pulls_url":"https://api.github.com/repos/implydata/pivot/pulls{/number}","milestones_url":"https://api.github.com/repos/implydata/pivot/milestones{/number}","notifications_url":"https://api.github.com/repos/implydata/pivot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/implydata/pivot/labels{/name}","releases_url":"https://api.github.com/repos/implydata/pivot/releases{/id}","deployments_url":"https://api.github.com/repos/implydata/pivot/deployments","created_at":"2015-07-23T23:12:28Z","updated_at":"2016-08-22T22:50:06Z","pushed_at":"2016-08-23T07:35:43Z","git_url":"git://github.com/implydata/pivot.git","ssh_url":"git@github.com:implydata/pivot.git","clone_url":"https://github.com/implydata/pivot.git","svn_url":"https://github.com/implydata/pivot","homepage":"","size":48575,"stargazers_count":551,"watchers_count":551,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":118,"mirror_url":null,"open_issues_count":38,"forks":118,"open_issues":38,"watchers":551,"default_branch":"master"}},"base":{"label":"implydata:master","ref":"master","sha":"d766b0c796b395b3fa703167af676aa31b190aec","user":{"login":"implydata","id":11660206,"avatar_url":"https://avatars.githubusercontent.com/u/11660206?v=3","gravatar_id":"","url":"https://api.github.com/users/implydata","html_url":"https://github.com/implydata","followers_url":"https://api.github.com/users/implydata/followers","following_url":"https://api.github.com/users/implydata/following{/other_user}","gists_url":"https://api.github.com/users/implydata/gists{/gist_id}","starred_url":"https://api.github.com/users/implydata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/implydata/subscriptions","organizations_url":"https://api.github.com/users/implydata/orgs","repos_url":"https://api.github.com/users/implydata/repos","events_url":"https://api.github.com/users/implydata/events{/privacy}","received_events_url":"https://api.github.com/users/implydata/received_events","type":"Organization","site_admin":false},"repo":{"id":39598888,"name":"pivot","full_name":"implydata/pivot","owner":{"login":"implydata","id":11660206,"avatar_url":"https://avatars.githubusercontent.com/u/11660206?v=3","gravatar_id":"","url":"https://api.github.com/users/implydata","html_url":"https://github.com/implydata","followers_url":"https://api.github.com/users/implydata/followers","following_url":"https://api.github.com/users/implydata/following{/other_user}","gists_url":"https://api.github.com/users/implydata/gists{/gist_id}","starred_url":"https://api.github.com/users/implydata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/implydata/subscriptions","organizations_url":"https://api.github.com/users/implydata/orgs","repos_url":"https://api.github.com/users/implydata/repos","events_url":"https://api.github.com/users/implydata/events{/privacy}","received_events_url":"https://api.github.com/users/implydata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/implydata/pivot","description":"An interactive data exploration UI for Druid","fork":false,"url":"https://api.github.com/repos/implydata/pivot","forks_url":"https://api.github.com/repos/implydata/pivot/forks","keys_url":"https://api.github.com/repos/implydata/pivot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/implydata/pivot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/implydata/pivot/teams","hooks_url":"https://api.github.com/repos/implydata/pivot/hooks","issue_events_url":"https://api.github.com/repos/implydata/pivot/issues/events{/number}","events_url":"https://api.github.com/repos/implydata/pivot/events","assignees_url":"https://api.github.com/repos/implydata/pivot/assignees{/user}","branches_url":"https://api.github.com/repos/implydata/pivot/branches{/branch}","tags_url":"https://api.github.com/repos/implydata/pivot/tags","blobs_url":"https://api.github.com/repos/implydata/pivot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/implydata/pivot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/implydata/pivot/git/refs{/sha}","trees_url":"https://api.github.com/repos/implydata/pivot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/implydata/pivot/statuses/{sha}","languages_url":"https://api.github.com/repos/implydata/pivot/languages","stargazers_url":"https://api.github.com/repos/implydata/pivot/stargazers","contributors_url":"https://api.github.com/repos/implydata/pivot/contributors","subscribers_url":"https://api.github.com/repos/implydata/pivot/subscribers","subscription_url":"https://api.github.com/repos/implydata/pivot/subscription","commits_url":"https://api.github.com/repos/implydata/pivot/commits{/sha}","git_commits_url":"https://api.github.com/repos/implydata/pivot/git/commits{/sha}","comments_url":"https://api.github.com/repos/implydata/pivot/comments{/number}","issue_comment_url":"https://api.github.com/repos/implydata/pivot/issues/comments{/number}","contents_url":"https://api.github.com/repos/implydata/pivot/contents/{+path}","compare_url":"https://api.github.com/repos/implydata/pivot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/implydata/pivot/merges","archive_url":"https://api.github.com/repos/implydata/pivot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/implydata/pivot/downloads","issues_url":"https://api.github.com/repos/implydata/pivot/issues{/number}","pulls_url":"https://api.github.com/repos/implydata/pivot/pulls{/number}","milestones_url":"https://api.github.com/repos/implydata/pivot/milestones{/number}","notifications_url":"https://api.github.com/repos/implydata/pivot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/implydata/pivot/labels{/name}","releases_url":"https://api.github.com/repos/implydata/pivot/releases{/id}","deployments_url":"https://api.github.com/repos/implydata/pivot/deployments","created_at":"2015-07-23T23:12:28Z","updated_at":"2016-08-22T22:50:06Z","pushed_at":"2016-08-23T07:35:43Z","git_url":"git://github.com/implydata/pivot.git","ssh_url":"git@github.com:implydata/pivot.git","clone_url":"https://github.com/implydata/pivot.git","svn_url":"https://github.com/implydata/pivot","homepage":"","size":48575,"stargazers_count":551,"watchers_count":551,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":118,"mirror_url":null,"open_issues_count":38,"forks":118,"open_issues":38,"watchers":551,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/implydata/pivot/pulls/358"},"html":{"href":"https://github.com/implydata/pivot/pull/358"},"issue":{"href":"https://api.github.com/repos/implydata/pivot/issues/358"},"comments":{"href":"https://api.github.com/repos/implydata/pivot/issues/358/comments"},"review_comments":{"href":"https://api.github.com/repos/implydata/pivot/pulls/358/comments"},"review_comment":{"href":"https://api.github.com/repos/implydata/pivot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/implydata/pivot/pulls/358/commits"},"statuses":{"href":"https://api.github.com/repos/implydata/pivot/statuses/67c6c3668523122ea448997099e44ee8c7f4d8d3"}}}}
{"actor":{"display_login":"lorem--ipsum"}}