AgapeIoan / SAMP-Stats

The source code of SAMP Stats Discord Bot
https://sampstats.agapeioan.ro
3 stars 0 forks source link

De rescris comenzile pentru a fi cat mai asynchronous #16

Closed AgapeIoan closed 2 years ago

AgapeIoan commented 2 years ago

https://github.com/AgapeIoan/RubyBOT-Rewrite/blob/6a60372365e136d813b9064370c2a86736e928b1/index.py#L50

AgapeIoan commented 2 years ago

Behavior: https://prnt.sc/22rozxa

Posibil, insa nu sigur, daca vine response tarziu de la panel, vine error-ul. Daca nu fac except la eroare, nu mai intra timeout la interactiune si posibil si alte chestii negasite yet. Se mai intampla si daca bot-ul primeste foarte multe requests. Aparent cu except-ul facut se mareste timp-ul de timeout cu cateva secunde bune.

AgapeIoan commented 2 years ago

Derivat din #18, las catch-ul pana la confirmare.

AgapeIoan commented 2 years ago

Din cauza lipsei de functii asynchronous, botul pusca la multe requests si nu le poate face pe toate in timp util. Astfel, .defer pusca ca nu se trimite la timp, o parte buna din comenzi sunt incetinite.

AgapeIoan commented 2 years ago

Am reusit sa rezolv ceva cu gevent si monkey patch pentru grequests iar acum nu imi mai crapa requests de slash command cand sunt prea multe, insa tot nu ruleaza in paralel cum as vrea.

AgapeIoan commented 2 years ago

Trecut de la requests la aiohttp, solved on ae9f5f10529d9c5c0af86004beb7f13d2347d43a (sper)

AgapeIoan commented 2 years ago

am zis bine ca e breaking changes