myNameIsArdens / Subcounter2.0

This program tracks my subscriber count by taking a picture repeatedly. And if I gain a subscriber, I get rickrolled.
https://www.youtube.com/watch?v=tebV7ycwgqI&t=1s&ab_channel=Ardens
MIT License
3 stars 1 forks source link

Prevent unnecessary rickroll #2

Open Joshua-Douglas opened 2 years ago

Joshua-Douglas commented 2 years ago

Current implementation will blast you with an unnecessary RickRoll if a user purposefully unsubscribes, waits 20 seconds, and then re-subscribes. Also, if the subcount increased by more than one then the program would unnecessarily wait 10 seconds between each roll. This will be a problem when you get a flood of subs all at once. To avoid a backlog of plays, let's just blast you all at once with a series of rolls.

Lastly, switch from using a list to a two-integer approach that tracks the current count and previous max. There is no need to continually append values to a subscriber count list - especially since we are in an infinite loop, so we risk consuming a lot of unnecessary memory this way.