Faced a problem. "In contact" sends my application via callback message from the user. To send a response to the user, the application makes 3 requests to api. When there were few messages, everything worked well. But now, during peak hours, the limit (3 requests per second) is exceeded and VC blocks requests. Question: how to organize the queue correctly - so that despite the large number of input messages, the application consistently turned to api 3 times per second.
- Use the execute method for optimization - mymedia
- It loads a picture. 1) requests the server; 2) loads; 3) saves; 4) sends. Because of the download will not work in this method to pack. - Vlad
- The type of stack needs something. Just how to organize it? In the database to write, and then process. Or an array. - Vlad
- Hmm ... then I would implement something with the help of an additional stream that only sends requests to the VC and falls asleep periodically, if necessary. For synchronization would use MessageQueue . When the main thread needs to send a message, it puts it in a queue, and the main thread wakes up either by timer or by the appearance of a new message to send. But maybe there is a way and easier - mymedia
|