{"action":"opened","issue":{"url":"https://api.github.com/repos/expressjs/session/issues/315","repository_url":"https://api.github.com/repos/expressjs/session","labels_url":"https://api.github.com/repos/expressjs/session/issues/315/labels{/name}","comments_url":"https://api.github.com/repos/expressjs/session/issues/315/comments","events_url":"https://api.github.com/repos/expressjs/session/issues/315/events","html_url":"https://github.com/expressjs/session/issues/315","id":155538295,"number":315,"title":"Handle writing to session after response has finished.","user":{"login":"jmacmahon","id":1281068,"avatar_url":"https://avatars.githubusercontent.com/u/1281068?v=3","gravatar_id":"","url":"https://api.github.com/users/jmacmahon","html_url":"https://github.com/jmacmahon","followers_url":"https://api.github.com/users/jmacmahon/followers","following_url":"https://api.github.com/users/jmacmahon/following{/other_user}","gists_url":"https://api.github.com/users/jmacmahon/gists{/gist_id}","starred_url":"https://api.github.com/users/jmacmahon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmacmahon/subscriptions","organizations_url":"https://api.github.com/users/jmacmahon/orgs","repos_url":"https://api.github.com/users/jmacmahon/repos","events_url":"https://api.github.com/users/jmacmahon/events{/privacy}","received_events_url":"https://api.github.com/users/jmacmahon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-18T15:54:21Z","updated_at":"2016-05-18T15:54:21Z","closed_at":null,"body":"Example code:\r\n```\r\napp.get('/set_session_deferred', function (req, res) {\r\n  res.on('finish', function () {\r\n    req.session.test = 'bla';\r\n  });\r\n});\r\n```\r\n\r\nThis data is not actually kept in the session.  I haven't looked at the code so I don't know why, but I imagine it's because session store synchronisation happens before the 'finish' event is emitted?"}}