{"action":"created","issue":{"url":"https://api.github.com/repos/meebey/smuxi/issues/218","labels_url":"https://api.github.com/repos/meebey/smuxi/issues/218/labels{/name}","comments_url":"https://api.github.com/repos/meebey/smuxi/issues/218/comments","events_url":"https://api.github.com/repos/meebey/smuxi/issues/218/events","html_url":"https://github.com/meebey/smuxi/issues/218","id":62108480,"number":218,"title":"UI locks while fetching data from server","user":{"login":"fsateler","id":1322013,"avatar_url":"https://avatars.githubusercontent.com/u/1322013?v=3","gravatar_id":"","url":"https://api.github.com/users/fsateler","html_url":"https://github.com/fsateler","followers_url":"https://api.github.com/users/fsateler/followers","following_url":"https://api.github.com/users/fsateler/following{/other_user}","gists_url":"https://api.github.com/users/fsateler/gists{/gist_id}","starred_url":"https://api.github.com/users/fsateler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fsateler/subscriptions","organizations_url":"https://api.github.com/users/fsateler/orgs","repos_url":"https://api.github.com/users/fsateler/repos","events_url":"https://api.github.com/users/fsateler/events{/privacy}","received_events_url":"https://api.github.com/users/fsateler/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-16T15:04:47Z","updated_at":"2015-03-16T16:24:18Z","closed_at":null,"body":"I recently expanded the amount of buffer lines to keep on the server, and noticed that now the extra data to fetch results in the UI becoming unresponsive while the data is being loaded.\r\n\r\nI am not sure if the problem is lock while fetching data or while building the UI. May be the latter since CPU usage tends to spike after a successful connection to the server.\r\n\r\nSmuxi version 0.11 on both windows and linux exhibit this behavior. The server I'm using is version 0.8.10 on debian wheezy.\r\n\r\n<bountysource-plugin>\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/9621773-ui-locks-while-fetching-data-from-server?utm_campaign=plugin&utm_content=tracker%2F277125&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F277125&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/meebey/smuxi/issues/comments/81774592","html_url":"https://github.com/meebey/smuxi/issues/218#issuecomment-81774592","issue_url":"https://api.github.com/repos/meebey/smuxi/issues/218","id":81774592,"user":{"login":"meebey","id":318066,"avatar_url":"https://avatars.githubusercontent.com/u/318066?v=3","gravatar_id":"","url":"https://api.github.com/users/meebey","html_url":"https://github.com/meebey","followers_url":"https://api.github.com/users/meebey/followers","following_url":"https://api.github.com/users/meebey/following{/other_user}","gists_url":"https://api.github.com/users/meebey/gists{/gist_id}","starred_url":"https://api.github.com/users/meebey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meebey/subscriptions","organizations_url":"https://api.github.com/users/meebey/orgs","repos_url":"https://api.github.com/users/meebey/repos","events_url":"https://api.github.com/users/meebey/events{/privacy}","received_events_url":"https://api.github.com/users/meebey/received_events","type":"User","site_admin":false},"created_at":"2015-03-16T16:24:18Z","updated_at":"2015-03-16T16:24:18Z","body":"Here is some context of this issue:\r\n\r\n17:14:24 <meebey> fsateler: the issue is Smuxi does fetches the backlog in a background thread\r\n17:14:36 <meebey> fsateler: but pushes ALL messages in a single loop into the UI\r\n17:14:40 <meebey> fsateler: and that is the UI hang you see\r\n17:14:51 <meebey> and yes GTK is that slow ;)\r\n17:15:41 <meebey> so the symptom is like \"hey Smuxi hangs, but this is easy to fix!\" not quite\r\n17:18:23 -!- hendrikm [~smuxi@62.65.217.242.cable.starman.ee] has joined #smuxi\r\n17:19:17 <fsateler> meebey: OK I see\r\n17:19:28 <meebey> fsateler: but it is an issue that should be fixed, no doubt\r\n17:19:38 <meebey> fsateler: it is just that it depends on user behavior/settings\r\n17:19:45 <meebey> fsateler: regular values do not cause harm :)\r\n17:19:49 <fsateler> meebey: can you hint me where should I be looking (source) to find that loop?\r\n17:19:57 <meebey> sure, hold on\r\n17:21:09 <meebey> fsateler: https://github.com/meebey/smuxi/blob/master/src/Frontend-GNOME/Views/Chats/ChatView.cs#L563\r\n17:21:34 <meebey> that loop needs to process the list in chunks\r\n17:21:40 <meebey> like 100 messages per iteration\r\n17:21:55 <meebey> it can use an anonymous method/lambda expression\r\n17:22:04 <meebey> GTK has an idle loop for this\r\n17:22:18 <meebey> so it would call it when GTK has time\r\n17:22:23 <meebey> as in no UI hang\r\n17:22:37 <meebey> example https://github.com/meebey/smuxi/blob/master/src/Frontend-GNOME/Views/Chats/ChatView.cs#L462\r\n17:23:01 <meebey> the return false means it does not want to be called again\r\n17:23:14 <meebey> if you return true, it will call the callback again\r\n"}}