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?
Is it possible to queue extension requests
Re: Is it possible to queue extension requests
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:
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
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
Who is online
Users browsing this forum: No registered users and 119 guests