(This is a conceptual question but as reference, I'm using Android Studio (Java) and Firebase Firestore...)

My app currently has a structure where the user can follow authors and favorite their works. Each user on the backend has a set of follows and favorites which updates according to this activity. This seems like a fairly straightforward task -- on each tap of a "Follow" or "Favorite" button, run a request to update that user's follows/favorites set (respectively).

However an issue continues to haunt me with this -- the user could very easily tap said button rapidly, sending a multitude of requests, for one, possibly overlapping on pending prior requests, and two, generally overflowing requests to the database. It does not feel wise to give the user that much power

So, my question is, what is the best way to handle updating data of this nature on the backend? Secondarily, is this even an issue in the first place? Is it okay to give the user that much control?

  • If one user tapping the button multiple times "haunts" you, I shudder to think what you will do to yourself when your app becomes successful and you have a million users all tapping a button even just once. – Jörg W Mittag Feb 16 '19 at 10:45
  • @JörgWMittag It's more of the idea that if it could be abused minimally, that it can still be scaled up. While I certainly don't think it's going to break a system, I certainly don't want to implement a poorly design structure if I would have the ability/knowledge to do so. Ergo why I came to StackExchange to ask, so thanks for that rather constructive response. – Jonny Feb 16 '19 at 11:29

Do not fear your users. Quote Frank Herbert: https://www.goodreads.com/quotes/2-i-must-not-fear-fear-is-the-mind-killer-fear-is The operations should be idempotent, that is, by pressing that button multiple times the user should not add multiple identical "follows" or "favorite" entries. You might set a sufficiently high limit (say, 100 authors and 500 works) depending on your audience. Abuse should probably dealt with when it happens, because it is hard to define simple rules that reliably detect it without flagging legitimate behavior.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.