Official Thimbleweed Park Forums

Discourse and the "can't give more likes" message


#21

I can’t believe you’re digging into the source code for this :slight_smile:

My theory would be the first like/post/login of the calendar day starts your count, then you have 24 hours (which is why I noticed a badge at 6am the next day, about 24 since I started checking the forum on Saturday morning)


#22

No, not that much. But sometimes you guys are writing one great post after another - and I would like to honor that with a “like”. If I like a post I would like to show that with a like. And I don’t exceed my like quota every day. :slight_smile: Beside that:


#23

I’m a computer scientist. I like to know how things and especially software work. :slight_smile:

Same here - but when does the calendar day starts? :slight_smile: If the calendar day starts at midnight German time, then why Discourse shows me the warning message? I haven’t liked that much posts and how does Discourse know that I’m living in Germany? I haven’t told him that.


#24

I would guess server time for wherever discourse is hosted.


#25

That leads us to my question in the first post. :wink:


#26

Because:

  • the post made me laugh
  • I agree with the post contents
  • the post contains positive thoughts
  • pictures, videos, sounds in the post are worth a mention (and a like)
  • I want to answer “Yes” if the post contains a question towards me

#27

Not sure, but it could be a sliding 24 hour window. So you can only give 50 likes over 24 hours.

Well, we all knew! And even if Discourse didn’t, it does so know.
Isn’t that right?
@discobot fortune


#28

:crystal_ball: Don’t count on it


#29

Don’t try and fool us by playing dumb…
@discobot fortune


#30

:crystal_ball: Yes


#31

How else are you supposed to find such information? The code is the only accurate documentation!

The key is built dynamically: limit_exceeded.rb

It seems to use sliding expiration: rate_limiter.rb


#32

Good point, Ron, er… I mean “Nor” :wink:


#33

Then this window has to start at some point. When is this? The first time I set a like?

But it’s Ruby code. :wink:

Can you point me to the code where the RateLimiter is used to check the Likes?


#34

Just whenever you like now it can check how much likes are less than 24h ago.
something like:
If press_like then update_nr_of_likes_since(now-24hours)
if nr_likes_in_last24h > 50 then print “you spend way too much time liking stuff here”


#35

@someone I think the best and faster way to answer all your questions is to sign up to the Discourse Meta Forums and ask them there or check out the dedicated threads. It’s the official forum for Discourse and you can chat directly with the developers. Me and PiecesOfKate are already signed up and I bet you’ll be welcome there as a long-term Discourse user and a computer scientist.


#36

Ah, Ok, right, now I got it. :slight_smile:


#37

Here the rate limiter checks the range: rate_limiter.rb#L68: if ((tonumber(redis.call("LLEN", key)) < max) or (now - tonumber(redis.call("LRANGE", key, -1, -1)[1])) > secs) then

Here are the rate limiters created: post_action.rb#L392 (note: there is a special case for likes involving a multiplier)


#38

This looks… inefficient. :wink:


#39

Great! Thanks!


#40

It was only for educational purposes :slight_smile: