-
Notifications
You must be signed in to change notification settings - Fork 271
Loads backlog from filesystem if logging enabled. #391
base: master
Are you sure you want to change the base?
Conversation
I created a fork of |
I've removed buffering in memory, it didn't add anything at all. Messages in memory are flushed every 50. @furier Can you elaborate? I understand you have a set of logs already in disk and shout isn't loading them when you press the button? |
You are talking about the show more button on the top of the channel? It didn't show up at all for me, the channel just started blank like I had no chat history. What I did step by step:
Shout starts up and everything seems to work fine except I cant see that your pull request has changed anything. |
@furier I think you were expecting the logs to be loaded when starting Shout (if they exist for any open channel). That functionality isn't actually implemented. Shout just shows the "show more" button if the channel received more than 100 messages after you joined and it only checks this when a channel is activated (by selecting it on the sidebar). So when the user presses this button some messages were fetched and prepended to the current chat conversation. My patch just makes Shout load those messages to be prepended from logs instead from the messages array in memory. You can just tell the difference by checking memory consumption with a reasonable number of channels open. |
Okay then I misunderstood the intent of the pull request, sorry @aynik. :) |
I noticed there are some coding style issues here. Spaces and tabs mixed as indentation character (tabs should be used afaik), missing whitespaces in function signatures ( These are not enforced in any way, so it's easy to miss. I'll open an issue for this. |
tabs should be converted to spaces always, use spaces always over tabs... man. 28. sep. 2015 kl. 08.08 skrev William Boman [email protected]:
|
@furier That's a personal preference. All/most code in this repo is indented with tabs so far. |
I have never ever worked at a project where they use tabs as standard indentation characters, usually its 4 spaces instead of a tab. Most IDEs also use 4 spaces instead of a tab, but be my guest... :) |
http://stackoverflow.com/research/developer-survey-2015#tech-tabsspaces If the entire project is already indented with tabs, then tabs it is - unless maintainers want to convert them to spaces and completely ruin |
Alright alright, let's focus on this PR, gentlepeople :-) However, my comments before burying that nice bikeshed:
Yes indeed. @aynik, I know there is no style checker yet, but if you could comply with what's already there, that would be great for consistency and would make the usage of a style checker doable :-) Once you change what @williamboman mentions, I'll point at other potential culprits.
That's a fine argument of why one should always use tabs that you have here :P
I have. It wasn't the best time of my life, but you know, you get used to it after the first 5 seconds. Also, what I like more than 4-space indentation is 2-space indentation, because 4-space indentation really hurts when you are trying to stay within 80-char lines, and you should (unless you like to hate yourself when coding from a plane, a bus, ... anywhere you use your 13" screen 😄). But what I like even more than 2-space indentation : ✨ consistency ✨
Well, the last 3 code editors I have been using for the last few years, and that are now very-widely used, favored 4-space indentations (and my current one doesn't care that much, it overwrites the default with the currently opened file's preference). So "Some IDEs", yes, "Most IDEs", no. WARNING: Please do not feed any troll nor answer my comments about {1-9,tab}-based indentation or other personal preferences in this chain of comment. Open an issue if you like, but let's keep this PR about the PR. Thank you. |
Sure, I didn't mean to hurt anybody's feelings. 😁 +1 Applying standard style to the whole project. |
What's the status of this PR? I'd love to see this feature in master, as I am also running shout in a very low-memory environment. |
I'm subscribing to this because it's an important feature I would like to see soon. |
This patch aims to reduce the memory footprint of the backlog. Before it, messages were just accumulated on memory. This adds now the possibility to load messages from the filesystem by seeking and parsing log files. This functionality is only triggered when logging is activated, keeping around 200 messages in memory and loading more if necessary. This modification came out of necessity as I run shout in a very limited VPS with just 128M of memory.
PD. Please consider auto-replacing tabs for spaces in the original code.