{"action":"created","issue":{"url":"https://api.github.com/repos/c9/core/issues/123","labels_url":"https://api.github.com/repos/c9/core/issues/123/labels{/name}","comments_url":"https://api.github.com/repos/c9/core/issues/123/comments","events_url":"https://api.github.com/repos/c9/core/issues/123/events","html_url":"https://github.com/c9/core/issues/123","id":99899563,"number":123,"title":"Persistency timing out","user":{"login":"jarodium","id":1470446,"avatar_url":"https://avatars.githubusercontent.com/u/1470446?v=3","gravatar_id":"","url":"https://api.github.com/users/jarodium","html_url":"https://github.com/jarodium","followers_url":"https://api.github.com/users/jarodium/followers","following_url":"https://api.github.com/users/jarodium/following{/other_user}","gists_url":"https://api.github.com/users/jarodium/gists{/gist_id}","starred_url":"https://api.github.com/users/jarodium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jarodium/subscriptions","organizations_url":"https://api.github.com/users/jarodium/orgs","repos_url":"https://api.github.com/users/jarodium/repos","events_url":"https://api.github.com/users/jarodium/events{/privacy}","received_events_url":"https://api.github.com/users/jarodium/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-09T14:13:38Z","updated_at":"2015-08-13T14:02:58Z","closed_at":null,"body":"Hello all\r\n\r\nThis is giving me timeouts in my debug mode:\r\n```\r\napi.getPersistentData(\"workspace\",function(err,data) {\r\n                    if (err) console.info(err);\r\n```\r\nI check the requests from my firebug console and I find that\r\nhttps://api.c9.dev/projects/0/persistent/0000000000000000000000000000=?access_token=token\r\n\r\nis taking 60s and then it times out.\r\n\r\nBest regards"},"comment":{"url":"https://api.github.com/repos/c9/core/issues/comments/130684545","html_url":"https://github.com/c9/core/issues/123#issuecomment-130684545","issue_url":"https://api.github.com/repos/c9/core/issues/123","id":130684545,"user":{"login":"nightwing","id":341801,"avatar_url":"https://avatars.githubusercontent.com/u/341801?v=3","gravatar_id":"","url":"https://api.github.com/users/nightwing","html_url":"https://github.com/nightwing","followers_url":"https://api.github.com/users/nightwing/followers","following_url":"https://api.github.com/users/nightwing/following{/other_user}","gists_url":"https://api.github.com/users/nightwing/gists{/gist_id}","starred_url":"https://api.github.com/users/nightwing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nightwing/subscriptions","organizations_url":"https://api.github.com/users/nightwing/orgs","repos_url":"https://api.github.com/users/nightwing/repos","events_url":"https://api.github.com/users/nightwing/events{/privacy}","received_events_url":"https://api.github.com/users/nightwing/received_events","type":"User","site_admin":false},"created_at":"2015-08-13T14:02:58Z","updated_at":"2015-08-13T14:02:58Z","body":"Sorry for a late reply.\r\nThe `getPersistentData` api is broken on master, and fixing it seems to take longer than we expected.\r\n\r\nuntil it is fixed please use the following snippet instead of `plugin.setAPIKey`\r\n\r\n```js\r\nvar fs = imports.fs\r\nfunction setAPIKey(apikey){\r\n    function getPersistentData(apiKey, type, callback){\r\n        fs.readFile(\"~/.c9/persistent/\" + type + \"/\" + apiKey, function(err, data){\r\n            if (err) return callback(err);\r\n            try { callback(null, JSON.parse(data)); }\r\n            catch(e){ return callback(e); }\r\n        });\r\n    }\r\n    \r\n    function setPersistentData(apiKey, type, data, callback){\r\n        fs.writeFile(\"~/.c9/persistent/\" + type + \"/\" + apiKey, JSON.stringify(data), {\r\n             parents:true\r\n        }, callback);\r\n    }\r\n    \r\n    return {\r\n        getPersistentData: getPersistentData.bind(this, apikey),\r\n        setPersistentData: setPersistentData.bind(this, apikey)\r\n    };\r\n}\r\n```\r\n\r\nit can be used exactly same way as the real setAPIKey\r\n\r\n```js\r\napi = setAPIKey(...);\r\napi.setPersistentData(\"workspace\", {xxa: 1}, function() {    \r\n})\r\n\r\napi.getPersistentData(\"workspace\", function(e,r) {\r\n    console.log(e,r)\r\n})\r\n```"}}