{"action":"created","issue":{"url":"https://api.github.com/repos/sandstorm-io/sandstorm/issues/2922","repository_url":"https://api.github.com/repos/sandstorm-io/sandstorm","labels_url":"https://api.github.com/repos/sandstorm-io/sandstorm/issues/2922/labels{/name}","comments_url":"https://api.github.com/repos/sandstorm-io/sandstorm/issues/2922/comments","events_url":"https://api.github.com/repos/sandstorm-io/sandstorm/issues/2922/events","html_url":"https://github.com/sandstorm-io/sandstorm/pull/2922","id":224861823,"number":2922,"title":"implement SandstormApi.schedulePeriodic()","user":{"login":"dwrensha","id":495768,"avatar_url":"https://avatars3.githubusercontent.com/u/495768?v=3","gravatar_id":"","url":"https://api.github.com/users/dwrensha","html_url":"https://github.com/dwrensha","followers_url":"https://api.github.com/users/dwrensha/followers","following_url":"https://api.github.com/users/dwrensha/following{/other_user}","gists_url":"https://api.github.com/users/dwrensha/gists{/gist_id}","starred_url":"https://api.github.com/users/dwrensha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwrensha/subscriptions","organizations_url":"https://api.github.com/users/dwrensha/orgs","repos_url":"https://api.github.com/users/dwrensha/repos","events_url":"https://api.github.com/users/dwrensha/events{/privacy}","received_events_url":"https://api.github.com/users/dwrensha/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-04-27T17:46:47Z","updated_at":"2017-04-29T21:40:01Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/sandstorm-io/sandstorm/pulls/2922","html_url":"https://github.com/sandstorm-io/sandstorm/pull/2922","diff_url":"https://github.com/sandstorm-io/sandstorm/pull/2922.diff","patch_url":"https://github.com/sandstorm-io/sandstorm/pull/2922.patch"},"body":""},"comment":{"url":"https://api.github.com/repos/sandstorm-io/sandstorm/issues/comments/298196275","html_url":"https://github.com/sandstorm-io/sandstorm/pull/2922#issuecomment-298196275","issue_url":"https://api.github.com/repos/sandstorm-io/sandstorm/issues/2922","id":298196275,"user":{"login":"kentonv","id":4001805,"avatar_url":"https://avatars3.githubusercontent.com/u/4001805?v=3","gravatar_id":"","url":"https://api.github.com/users/kentonv","html_url":"https://github.com/kentonv","followers_url":"https://api.github.com/users/kentonv/followers","following_url":"https://api.github.com/users/kentonv/following{/other_user}","gists_url":"https://api.github.com/users/kentonv/gists{/gist_id}","starred_url":"https://api.github.com/users/kentonv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kentonv/subscriptions","organizations_url":"https://api.github.com/users/kentonv/orgs","repos_url":"https://api.github.com/users/kentonv/repos","events_url":"https://api.github.com/users/kentonv/events{/privacy}","received_events_url":"https://api.github.com/users/kentonv/received_events","type":"User","site_admin":false},"created_at":"2017-04-29T21:40:01Z","updated_at":"2017-04-29T21:40:01Z","body":"Cool stuff!\r\n\r\nIt's interesting that the two-phase commit problem comes up here. I wonder if we really ought to generalize it to all persistent capabilities. However, last time I thought about this problem, I concluded that forcing developers to understand two-phase commit was a big burden that wouldn't bring much benefit 99% of the time. In most cases, if the app loses a token, it doesn't really matter. The capability can just stick around, or it can be cleaned up when the grain is deleted, or the user can clean it up manually.\r\n\r\nIt does seem like it matters in this case, though.\r\n\r\nMaybe apps should be able to opt-in to two-phase commit. `SandstormApi.save()` could take an extra boolean parameter `requireConfirmation`. If true, then the token must be passed to `SandstormApi.confirm()` after it has been persisted, otherwise Sandstorm will automatically drop it after some timeout.\r\n\r\nThe idea is that a grain would:\r\n1. Call `save()`.\r\n2. Store the token to its database, flagged as \"not confirmed\".\r\n3. Call `confirm()`.\r\n4. Update its database to mark the token \"confirmed\".\r\n\r\nIn case the grain crashes between `save()` and `confirm()`, on every startup it checks its database for unconfirmed tokens. If it finds any, it must either retry `confirm()` on them or call `drop()`. This ensures consistency between Sandstorm and the grain.\r\n\r\nThoughts?"}}
{"actor":{"display_login":"kentonv"}}