{"action":"created","issue":{"url":"https://api.github.com/repos/CrowdHailer/raxx/issues/105","repository_url":"https://api.github.com/repos/CrowdHailer/raxx","labels_url":"https://api.github.com/repos/CrowdHailer/raxx/issues/105/labels{/name}","comments_url":"https://api.github.com/repos/CrowdHailer/raxx/issues/105/comments","events_url":"https://api.github.com/repos/CrowdHailer/raxx/issues/105/events","html_url":"https://github.com/CrowdHailer/raxx/issues/105","id":315764023,"node_id":"MDU6SXNzdWUzMTU3NjQwMjM=","number":105,"title":"Add a functionality to set a date on responses.","user":{"login":"CrowdHailer","id":5862302,"node_id":"MDQ6VXNlcjU4NjIzMDI=","avatar_url":"https://avatars3.githubusercontent.com/u/5862302?v=4","gravatar_id":"","url":"https://api.github.com/users/CrowdHailer","html_url":"https://github.com/CrowdHailer","followers_url":"https://api.github.com/users/CrowdHailer/followers","following_url":"https://api.github.com/users/CrowdHailer/following{/other_user}","gists_url":"https://api.github.com/users/CrowdHailer/gists{/gist_id}","starred_url":"https://api.github.com/users/CrowdHailer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CrowdHailer/subscriptions","organizations_url":"https://api.github.com/users/CrowdHailer/orgs","repos_url":"https://api.github.com/users/CrowdHailer/repos","events_url":"https://api.github.com/users/CrowdHailer/events{/privacy}","received_events_url":"https://api.github.com/users/CrowdHailer/received_events","type":"User","site_admin":false},"labels":[{"id":390998887,"node_id":"MDU6TGFiZWwzOTA5OTg4ODc=","url":"https://api.github.com/repos/CrowdHailer/raxx/labels/help%20wanted","name":"help wanted","color":"128A0C","default":true},{"id":390998890,"node_id":"MDU6TGFiZWwzOTA5OTg4OTA=","url":"https://api.github.com/repos/CrowdHailer/raxx/labels/wontfix","name":"wontfix","color":"006b75","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-04-19T07:50:01Z","updated_at":"2018-09-09T23:54:49Z","closed_at":"2018-09-09T23:54:49Z","author_association":"OWNER","body":"Because looking up the time can be relatively expensive, we should not look it up for every request.\r\n\r\nI suggest having a process that writes the date to an ets table every second. and other processes can read from this table to set the value in a response. This is how I think cowboy does it.\r\n\r\n1. To start the writing process something like this should be added to the application supervision tree\r\n  ```elixir\r\n  {Raxx.Date, [interval: 1_000]}\r\n  ```\r\n  This creates a named ets table called `:\"raxx.date\"`and writes to it every second\r\n\r\n2. The current date can be explicitly written to a response as follows\r\n  ```elixir\r\n  Raxx.set_date(response) \r\n  ```\r\n  This looks up date from `:\"raxx.date\"`\r\n\r\n3. Calls to `set_date` can be wrapped up in a middleware. `use Raxx.Date` that can be added to router/controller\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/CrowdHailer/raxx/issues/comments/419754449","html_url":"https://github.com/CrowdHailer/raxx/issues/105#issuecomment-419754449","issue_url":"https://api.github.com/repos/CrowdHailer/raxx/issues/105","id":419754449,"node_id":"MDEyOklzc3VlQ29tbWVudDQxOTc1NDQ0OQ==","user":{"login":"CrowdHailer","id":5862302,"node_id":"MDQ6VXNlcjU4NjIzMDI=","avatar_url":"https://avatars3.githubusercontent.com/u/5862302?v=4","gravatar_id":"","url":"https://api.github.com/users/CrowdHailer","html_url":"https://github.com/CrowdHailer","followers_url":"https://api.github.com/users/CrowdHailer/followers","following_url":"https://api.github.com/users/CrowdHailer/following{/other_user}","gists_url":"https://api.github.com/users/CrowdHailer/gists{/gist_id}","starred_url":"https://api.github.com/users/CrowdHailer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CrowdHailer/subscriptions","organizations_url":"https://api.github.com/users/CrowdHailer/orgs","repos_url":"https://api.github.com/users/CrowdHailer/repos","events_url":"https://api.github.com/users/CrowdHailer/events{/privacy}","received_events_url":"https://api.github.com/users/CrowdHailer/received_events","type":"User","site_admin":false},"created_at":"2018-09-09T23:54:49Z","updated_at":"2018-09-09T23:54:49Z","author_association":"OWNER","body":"Removed as not blocking anyone at the moment.\r\n\r\nWaiting for a standard middleware format, or opinionatedly can just be handled in the server layer"}}
{"actor":{"display_login":"CrowdHailer"}}