Is it possible to queue extension requests

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

User avatar
mete2221
Posts: 53
Joined: 30 Aug 2017, 17:01

Is it possible to queue extension requests

Postby mete2221 » 28 Jun 2022, 19:43

The user can exploit the service by repeatedly calling an extension by taking advantage of the latency in the database.

Is it possible to put requests in a user-based queue for such cases?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Is it possible to queue extension requests

Postby Lapo » 29 Jun 2022, 07:27

Hi,
if you're worried about clients spamming your Extension you can easily implement a sort of cooldown for specific requests (or even all of them, if necessary).

In your request handler you can store the current time (System.currentTimeMillis or System.nanoTime) as a property of the User:
Example:

Code: Select all

sender.setProperty("lastXYZReqTime", System.currentTimeMillis());

The next time the the same request is called again you can check how much time has passed since the last request and decide if it's legit or not. If it was called too early you can simply drop the request.

Makes sense?

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 59 guests