ilyalatt / Telega

C# Telegram MTProto Client
https://ilyalatt.github.io/Telega/
MIT License
58 stars 15 forks source link

New adaptive flood middleware #59

Open ilyalatt opened 3 years ago

ilyalatt commented 3 years ago

Current middleware just waits a random time on each query except files requests. Here it a better idea. Keep a map of (RequestType, CallInfo). CallInfo represents sliding window of calls with size about 1 minute. If we got FloodException then we can count how much requests can be made and calculate delay.