Skip to content

Conversation

@alex75311
Copy link

Description

redesigned the antiflood method for guaranteed message delivery

Checklist:

  • I added/edited example on new feature/change (if exists)
  • My changes won't break backward compatibility
  • I made changes both for sync and async

@coder2020official
Copy link
Collaborator

Hi!
Thank you for PR. We'll review it after bot api 6.6 update

@Badiboy
Copy link
Collaborator

Badiboy commented Mar 27, 2023

What is the reason for loop if there is a sleep for all the required time?

@alex75311
Copy link
Author

the library uses multithreading. another thread manages to squeeze in and send, and part of the threads returns error 429 with a new timeout. my solution guarantees that the message will be sent\modified.

@alex75311
Copy link
Author

using the previous solution, I still continue to receive 429 errors when sending/changing messages in bulk. this decision corrected the situation

@coder2020official
Copy link
Collaborator

Should be tested first

@coder2020official
Copy link
Collaborator

the original function does not raise an error when the message is not delivered, i don't see any reason for redesigning cuz the previous version already handles 429 error which is the only error to be handled

@alex75311
Copy link
Author

above I described a case in which the current solution did not work for me, so I changed it to a solution that delivers 100% messages.

@coder2020official
Copy link
Collaborator

But raising the error is a breaking change

@Badiboy
Copy link
Collaborator

Badiboy commented May 2, 2023

But raising the error is a breaking change

It raised error before. With this update it will raise it more rare.

From my side I cannot accept infinite loops in processing. Various things may happen, thus infinite loop will bring to stall. Loop may exist but it should be finite. May be with configurable (by parameter) number of retries.
@alex75311 👆

@alex75311 alex75311 force-pushed the edit_antiflood_method branch 2 times, most recently from e1ec77e to 9e476b9 Compare May 4, 2023 19:58
@alex75311
Copy link
Author

I added 5 attempts, that should be enough

@alex75311 alex75311 force-pushed the edit_antiflood_method branch from 9e476b9 to 14294d1 Compare May 4, 2023 20:08
@Badiboy
Copy link
Collaborator

Badiboy commented May 5, 2023

@coder2020official Looks fine for me now.

@coder2020official
Copy link
Collaborator

@Badiboy should the function raise an error when apitelegramexception is thrown?

@Badiboy
Copy link
Collaborator

Badiboy commented May 5, 2023

@coder2020official Reasonable.

@alex75311 Please, set in line 628 "raise" instead of "return ...".

@coder2020official
Copy link
Collaborator

i am talking about last line:
image
why is an error being raised? is it intended?

@alex75311
Copy link
Author

if we are talking about line 6 of your screenshot, then this exception is called if the function returned an error other than 429

@coder2020official
Copy link
Collaborator

Yes, is it intended? Before it never raised an error

@alex75311
Copy link
Author

look carefully at how it was before

@Badiboy
Copy link
Collaborator

Badiboy commented May 7, 2023

Yes, is it intended? Before it never raised an error

image

Absolutely the same.

@coder2020official
Copy link
Collaborator

Fine then, I probably skipped the last part

@Badiboy Badiboy merged commit 48377ac into eternnoir:master May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants