-1

(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?

Jonny
  • 99

1 Answers1

2

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.