mira icon indicating copy to clipboard operation
mira copied to clipboard

Streaming comments stops working...

Open tildewtf opened this issue 4 years ago • 2 comments

Hi there.

When using the library's streaming comments capability:

comments, err := r.Subreddit("aww").StreamComments()
if err != nil {
	log.Println(err)
}

It will work for awhile (usually 10-20 minutes), but then just stop streaming new comments, even on very active subreddits. There are no errors being returned as far as I can tell. Has anyone else experienced this issue?

tildewtf avatar Oct 13 '20 04:10 tildewtf

I experienced something similar. The problem is that mira requests posts/comments after a specific one - if that one is removed/deleted, reddit will just return an empty result.

In my fork (https://github.com/ttgmpsn/mira) I worked around that by always fetching the 100 newest comments, and saving what was already sent out in a ring buffer (the ring buffer, compared to simply keeping a list of what has been sent, is more memory efficient over time), only sending out new stuff. Feel free to check it out (quick warning though, the fork is not a drop-in replacement anymore, because I chose to make certain things differently while keeping the general idea of this library)!

ghost avatar Oct 16 '20 17:10 ghost

@ttgmpsn I'm looking at your fork right now and I must say this is really good! If you ever want to merge your fork to this one, lmk

thecsw avatar Oct 16 '20 18:10 thecsw